From da59eabaedcc230345de8c1ce87f79a7bf962e17 Mon Sep 17 00:00:00 2001 From: Katherine Chen Date: Tue, 21 Jul 2026 16:47:11 +1000 Subject: [PATCH] UID2-7263 Skip SNAPSHOT publishing in Android SDK build workflow The "Deploy to Maven Central" step ran ./gradlew publish on every push to main. With SONATYPE_HOST=CENTRAL_PORTAL and VERSION_NAME=2.2.0-SNAPSHOT, the Central Portal rejects SNAPSHOTs with a 403 Forbidden, failing every build. Read VERSION_NAME from gradle.properties and gate the publish step so it only runs for non-SNAPSHOT (release) versions. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e5b471..31d5bcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,8 +32,14 @@ jobs: with: scan_type: 'fs' - - name: Deploy SNAPSHOT to Maven Central - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + - name: Read version name + id: version + run: echo "name=$(grep '^VERSION_NAME=' gradle.properties | cut -d'=' -f2)" >> "$GITHUB_OUTPUT" + + # The Sonatype Central Portal (SONATYPE_HOST=CENTRAL_PORTAL) does not support + # SNAPSHOT publishing, so skip this step for -SNAPSHOT versions to avoid a 403. + - name: Deploy to Maven Central + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !endsWith(steps.version.outputs.name, '-SNAPSHOT') run: ./gradlew publish --stacktrace env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_SONATYPE_REPO_USERNAME }}