Skip to content

Commit ffb13bf

Browse files
Fix Android Maven Central publishing (#23190)
The Android release workflow has continued publishing AARs to S3, but releases after 1.4.0 have not created deployments in Maven Central. The release jobs reported success, so this failed silently. The Maven plugin was still pinned to 0.31.0. Version 0.33 changed parameterless `publishToMavenCentral()` to use the Central Portal instead of the retired legacy OSSRH service, and 0.34 updates to the current Portal APIs. This PR upgrades to 0.34.0 while deliberately retaining the upload-only task: it creates a deployment for release owners to review and publish manually in the Central Portal. A manual Maven retry exposed a separate problem. Its container initialized successfully, but the workflow reran generic Linux setup and failed because the old `torchao==0.18.0.dev20260729` wheel is unavailable. The final `Executing the custom container implementation failed` line was the job wrapper reporting that script failure, not the root cause. This change: - routes uploads to the Central Portal with the updated plugin; - keeps publication manual by using `publishToMavenCentral`; - adds the Central Portal review link to the job summary; - separates the S3 existence check from Maven retry handling, so an existing S3 AAR does not suppress a Maven retry; - preserves existing S3 artifacts during Maven-only retries; - removes the redundant failing Linux setup; and - adds an optional source ref so a released tag can be rebuilt exactly. Validation: Ruby YAML parsing and `git diff --check`. This PR was authored with Claude.
1 parent a318382 commit ffb13bf

2 files changed

Lines changed: 42 additions & 11 deletions

File tree

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

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ on:
99
type: string
1010
default: ''
1111
upload_to_maven:
12-
description: Upload the AAR to maven staging repository
12+
description: Upload the AAR to Maven Central for manual review
1313
required: false
1414
type: boolean
1515
default: false
16+
source_ref:
17+
description: Git ref or SHA to build; defaults to the workflow commit
18+
required: false
19+
type: string
20+
default: ''
1621
flavor:
1722
description: Build flavor
1823
required: false
@@ -25,9 +30,13 @@ on:
2530
required: false
2631
type: string
2732
upload_to_maven:
28-
description: Upload the AAR to maven staging repository
33+
description: Upload the AAR to Maven Central for manual review
2934
required: false
3035
type: boolean
36+
source_ref:
37+
description: Git ref or SHA to build; defaults to the workflow commit
38+
required: false
39+
type: string
3140
flavor:
3241
type: choice
3342
options:
@@ -49,6 +58,7 @@ jobs:
4958
runs-on: ubuntu-22.04
5059
timeout-minutes: 10
5160
outputs:
61+
aar-exists: ${{ steps.check.outputs.aar-exists }}
5262
should-skip: ${{ steps.check.outputs.should-skip }}
5363
steps:
5464
- name: Check if this RC version is already in S3
@@ -57,19 +67,32 @@ jobs:
5767
run: |
5868
VERSION="${{ inputs.version }}"
5969
FLAVOR="${{ inputs.flavor }}"
70+
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
6071
if [ -z "$FLAVOR" ]; then
6172
FLAVOR="xnnpack"
6273
fi
74+
if [[ "$UPLOAD_TO_MAVEN" == "true" && -z "$VERSION" ]]; then
75+
echo "A version is required when publishing to Maven Central"
76+
exit 1
77+
fi
6378
if [ -z "$VERSION" ]; then
6479
echo "No version name specified. Will create a snapshot AAR"
80+
echo "aar-exists=false" >> $GITHUB_OUTPUT
6581
echo "should-skip=false" >> $GITHUB_OUTPUT
6682
exit 0
6783
fi
6884
if curl -I "https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}-${FLAVOR}/executorch.aar" | grep "200 OK"; then
6985
echo "AAR already exists at https://ossci-android.s3.amazonaws.com/executorch/release/${VERSION}-${FLAVOR}/executorch.aar"
70-
echo "Will skip build/upload"
71-
echo "should-skip=true" >> $GITHUB_OUTPUT
86+
echo "aar-exists=true" >> $GITHUB_OUTPUT
87+
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
88+
echo "Maven publishing requested. Will rebuild without replacing the S3 artifact"
89+
echo "should-skip=false" >> $GITHUB_OUTPUT
90+
else
91+
echo "Will skip build/upload"
92+
echo "should-skip=true" >> $GITHUB_OUTPUT
93+
fi
7294
else
95+
echo "aar-exists=false" >> $GITHUB_OUTPUT
7396
echo "should-skip=false" >> $GITHUB_OUTPUT
7497
fi
7598
@@ -86,7 +109,7 @@ jobs:
86109
secrets-env: EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
87110
docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-clang12-android-${{ needs.docker-image.outputs.ci-docker-hash }}
88111
submodules: 'recursive'
89-
ref: ${{ github.sha }}
112+
ref: ${{ inputs.source_ref || github.sha }}
90113
timeout: 90
91114
upload-artifact: android-apps
92115
upload-artifact-to-s3: true
@@ -97,10 +120,9 @@ jobs:
97120
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
98121
export CMAKE_C_COMPILER_LAUNCHER=sccache
99122
100-
# The generic Linux job chooses to use base env, not the one setup by the image
123+
# The Android image already contains the build dependencies and pinned PyTorch.
101124
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
102125
conda activate "${CONDA_ENV}"
103-
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
104126
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
105127
106128
mkdir -p ~/.gradle
@@ -157,15 +179,22 @@ jobs:
157179
158180
shasum -a 256 "${ARTIFACTS_DIR_NAME}/executorch-${FLAVOR}.aar"
159181
160-
# Publish to maven staging
182+
# Upload a deployment to Maven Central. A release owner reviews and
183+
# publishes it manually in the Central Portal.
161184
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
162185
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
163-
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew ${GRADLE_ARGS} :executorch_android:publishToMavenCentral)
186+
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew --no-daemon --console=plain ${GRADLE_ARGS} :executorch_android:publishToMavenCentral)
187+
{
188+
echo "### Maven Central deployment uploaded"
189+
echo
190+
echo "Review and publish the deployment in the [Central Portal](https://central.sonatype.com/publishing/deployments)."
191+
} >> "$GITHUB_STEP_SUMMARY"
164192
fi
165193
166194
upload-release-aar:
167195
name: upload-release-aar
168-
needs: build-aar
196+
needs: [check-if-aar-exists, build-aar]
197+
if: ${{ needs.check-if-aar-exists.outputs.aar-exists != 'true' }}
169198
runs-on: ubuntu-22.04
170199
timeout-minutes: 10
171200
permissions:

‎extension/android/executorch_android/build.gradle‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
plugins {
1111
id "com.android.library" version "8.9.0"
12-
id "com.vanniktech.maven.publish" version "0.31.0"
12+
// 0.33+ routes publishToMavenCentral() through the Central Portal instead
13+
// of the retired legacy OSSRH service.
14+
id "com.vanniktech.maven.publish" version "0.34.0"
1315
id 'com.diffplug.spotless' version '8.0.0'
1416
alias(libs.plugins.jetbrains.kotlin.android)
1517
}

0 commit comments

Comments
 (0)