-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathrelease-android-maven-central.yml
More file actions
70 lines (61 loc) · 3.33 KB
/
release-android-maven-central.yml
File metadata and controls
70 lines (61 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
version: 0.2
# this buildspec assumes the ubuntu image
# This job is responsible for release aws-crt-android to Maven Central.
phases:
install:
commands:
- sudo apt-get update -y
# Java 17 for AGP 8.x
- sudo apt-get install -y openjdk-17-jdk-headless maven wget unzip gnupg
- export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
- export PATH="$JAVA_HOME/bin:$PATH"
- export ORG_GRADLE_JAVA_HOME="$JAVA_HOME"
# install android sdk
- export ANDROID_SDK_ROOT=$CODEBUILD_SRC_DIR/android-sdk
- export ANDROID_HOME="$ANDROID_SDK_ROOT" # settings.gradle checks ANDROID_HOME
- mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
- wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
- unzip -q commandlinetools-linux-11076708_latest.zip -d "$ANDROID_SDK_ROOT/cmdline-tools"
# This weird path needed for cmd tool to work
- mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
- export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH"
# Platform/Build-Tools for compileSdk 35, NDK r28, and CMake
- yes | sdkmanager --install "platform-tools" "build-tools;35.0.0" "platforms;android-35" "ndk;28.0.12433566" "cmake;3.22.1"
- yes | sdkmanager --licenses
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR/aws-crt-java
- export PKG_VERSION=$(git describe --tags | cut -f2 -dv)
- echo $PKG_VERSION
# install settings.xml to ~/.m2/settings.xml
- mkdir -p $HOME/.m2
- aws s3 cp s3://code-sharing-aws-crt/aws-crt-java.settings.token.xml $HOME/.m2/settings.xml
# import gpg key
- aws s3 cp s3://code-sharing-aws-crt/aws-sdk-common-runtime.key.asc /tmp/aws-sdk-common-runtime.key.asc
# for https://github.com/keybase/keybase-issues/issues/2798
- export GPG_TTY=$(tty)
- gpg --batch --import /tmp/aws-sdk-common-runtime.key.asc
# refer to https://maven.apache.org/plugins/maven-gpg-plugin/usage.html
- export MAVEN_GPG_PASSPHRASE=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id aws-sdk-common-runtime.key.asc/password --region us-east-1 | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
- export ST_USERNAME=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token --region us-east-1 | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/[\\\"\}]//g')
- export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token --region us-east-1 | cut -f3 -d":" | sed -e 's/[\\\"\}]//g')
# Use the username and password from secret manager to update the settings
- sed -i 's|token-username|'"$ST_USERNAME"'|g' $HOME/.m2/settings.xml
- sed -i 's|token-password|'"$ST_PASSWORD"'|g' $HOME/.m2/settings.xml
# Sanity prints
- java -version
- ./gradlew -v
build:
commands:
# update the version to match the git tag, make a staging release which we will release once snapshot testing passes
- export DEPLOY_VERSION=${PKG_VERSION}
- mvn -B versions:set -DnewVersion=${DEPLOY_VERSION}
- export PROMOTE_RELEASE=true
# deploy android
- bash ./codebuild/cd/publish-android.sh
post_build:
commands:
- echo "Build & publish steps completed."
cache:
paths:
- "/root/.m2/**/*"