Skip to content

Commit 3dc7639

Browse files
authored
android-release-artifacts.yml allow upload AAR to maven (#9954)
Add an option to upload the AAR to maven staging repository. Validated it's working both with and without the AAR upload option.
1 parent 87aa699 commit 3dc7639

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/android-release-artifacts.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
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
1014

1115
concurrency:
1216
group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,11 +35,14 @@ jobs:
3135
build-aar:
3236
name: build-aar
3337
needs: check-if-aar-exists
34-
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
38+
if: ${{ !github.event.pull_request.head.repo.fork }}
39+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.7
40+
secrets: inherit
3541
permissions:
3642
id-token: write
3743
contents: read
3844
with:
45+
secrets-env: EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
3946
runner: linux.2xlarge
4047
docker-image: executorch-ubuntu-22.04-clang12-android
4148
submodules: 'true'
@@ -52,6 +59,16 @@ jobs:
5259
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
5360
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
5461
62+
mkdir -p ~/.gradle
63+
touch ~/.gradle/gradle.properties
64+
echo "signing.keyId=${SECRET_EXECUTORCH_MAVEN_SIGNING_KEYID}" >> ~/.gradle/gradle.properties
65+
echo "signing.password=${SECRET_EXECUTORCH_MAVEN_SIGNING_PASSWORD}" >> ~/.gradle/gradle.properties
66+
echo "mavenCentralUsername=${SECRET_EXECUTORCH_MAVEN_CENTRAL_USERNAME}" >> ~/.gradle/gradle.properties
67+
echo "mavenCentralPassword=${SECRET_EXECUTORCH_MAVEN_CENTRAL_PASSWORD}" >> ~/.gradle/gradle.properties
68+
echo "signing.secretKeyRingFile=/tmp/secring.gpg" >> ~/.gradle/gradle.properties
69+
70+
echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
71+
5572
# Build AAR Package
5673
mkdir aar-out
5774
export BUILD_AAR_DIR=aar-out
@@ -61,6 +78,12 @@ jobs:
6178
6279
shasum -a 256 "${ARTIFACTS_DIR_NAME}/executorch.aar"
6380
81+
# Publish to maven staging
82+
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
83+
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
84+
(cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
85+
fi
86+
6487
upload-release-aar:
6588
name: upload-release-aar
6689
needs: build-aar

extension/android/executorch_android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mavenPublishing {
4848
publishToMavenCentral(SonatypeHost.DEFAULT)
4949
signAllPublications()
5050

51-
coordinates("org.pytorch", "executorch-android", "0.5.0-SNAPSHOT")
51+
coordinates("org.pytorch", "executorch-android", "0.7.0")
5252

5353
pom {
5454
name = "ExecuTorch Android"

0 commit comments

Comments
 (0)