77 description : Version name to be uploaded for AAR release
88 required : false
99 type : string
10+ upload_to_maven :
11+ description : Upload the AAR to maven staging repository
12+ required : false
13+ type : boolean
14+ schedule :
15+ - cron : 0 10 * * *
1016
1117concurrency :
1218 group : ${{ github.workflow }}-${{ github.ref }}
2228 shell : bash
2329 run : |
2430 VERSION="${{ inputs.version }}"
31+ if [ -z "$VERSION" ]; then
32+ echo "No version name specified. Will create a snapshot AAR"
33+ exit 0
34+ fi
2535 if curl -I "https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar" | grep "200 OK"; then
2636 echo "AAR already exists at https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}/executorch.aar"
2737 echo "Will skip build/upload"
@@ -31,27 +41,45 @@ jobs:
3141 build-aar :
3242 name : build-aar
3343 needs : check-if-aar-exists
34- uses : pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
44+ if : ${{ !github.event.pull_request.head.repo.fork }}
45+ uses : pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.7
46+ secrets : inherit
3547 permissions :
3648 id-token : write
3749 contents : read
3850 with :
39- runner : linux.2xlarge
51+ secrets-env : EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
52+ # As this job has access to Maven credential, run this on a fresh ephemeral runner
53+ runner : ephemeral.linux.2xlarge
4054 docker-image : executorch-ubuntu-22.04-clang12-android
41- submodules : ' true '
55+ submodules : ' recursive '
4256 ref : ${{ github.sha }}
4357 timeout : 90
4458 upload-artifact : android-apps
4559 upload-artifact-to-s3 : true
4660 script : |
4761 set -eux
4862
63+ # Use sccache for NDK compiler as well
64+ export CMAKE_CXX_COMPILER_LAUNCHER=sccache
65+ export CMAKE_C_COMPILER_LAUNCHER=sccache
66+
4967 # The generic Linux job chooses to use base env, not the one setup by the image
5068 CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
5169 conda activate "${CONDA_ENV}"
5270 PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
5371 export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
5472
73+ mkdir -p ~/.gradle
74+ touch ~/.gradle/gradle.properties
75+ echo "signing.keyId=${SECRET_EXECUTORCH_MAVEN_SIGNING_KEYID}" >> ~/.gradle/gradle.properties
76+ echo "signing.password=${SECRET_EXECUTORCH_MAVEN_SIGNING_PASSWORD}" >> ~/.gradle/gradle.properties
77+ echo "mavenCentralUsername=${SECRET_EXECUTORCH_MAVEN_CENTRAL_USERNAME}" >> ~/.gradle/gradle.properties
78+ echo "mavenCentralPassword=${SECRET_EXECUTORCH_MAVEN_CENTRAL_PASSWORD}" >> ~/.gradle/gradle.properties
79+ echo "signing.secretKeyRingFile=/tmp/secring.gpg" >> ~/.gradle/gradle.properties
80+
81+ echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
82+
5583 # Build AAR Package
5684 mkdir aar-out
5785 export BUILD_AAR_DIR=aar-out
6189
6290 shasum -a 256 "${ARTIFACTS_DIR_NAME}/executorch.aar"
6391
92+ # Publish to maven staging
93+ UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
94+ if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
95+ (cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
96+ fi
97+
6498 upload-release-aar :
6599 name : upload-release-aar
66100 needs : build-aar
84118 pip install awscli==1.32.18
85119 AWS_CMD="aws s3 cp"
86120 VERSION="${{ inputs.version }}"
87- VERSION_NAME="${VERSION:-temp_snapshot}"
88- ${AWS_CMD} executorch.aar s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar --acl public-read
89- ${AWS_CMD} executorch.aar.sha256sums s3://ossci-android/executorch/release/${VERSION_NAME}/executorch.aar.sha256sums --acl public-read
121+ if [ -z "$VERSION" ]; then
122+ VERSION="snapshot-$(date +"%Y%m%d")"
123+ fi
124+ ${AWS_CMD} executorch.aar s3://ossci-android/executorch/release/${VERSION}/executorch.aar --acl public-read
125+ ${AWS_CMD} executorch.aar.sha256sums s3://ossci-android/executorch/release/${VERSION}/executorch.aar.sha256sums --acl public-read
0 commit comments