From 8a63515d0d194b67547f8f5029f1914fdcb5d115 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Wed, 25 Nov 2026 09:04:40 -0400 Subject: [PATCH] ci: move GitHub release creation into its own job Follow-up to the review feedback on the release-on-publish change: run the release step in a separate create-release job (needs: publish-android) so only that job gets contents: write. The Gradle build, which handles the signing key and Maven credentials, keeps a read-only token, and a failed release can be retried with "Re-run failed jobs" without republishing. --- .github/workflows/publish-android.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index aefa093..724848e 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -5,8 +5,11 @@ on: workflow_dispatch jobs: publish-android: runs-on: ubuntu-latest + outputs: + published: ${{ steps.publish.outputs.published }} + version: ${{ steps.publish.outputs.version }} permissions: - contents: write + contents: read packages: write steps: - uses: actions/checkout@v4 @@ -34,12 +37,21 @@ jobs: id: publish working-directory: ./scripts run: ./publish-android.sh + + create-release: + # Separate job so only this one gets contents: write; the Gradle build above keeps a read-only token. + # If the release fails, "Re-run failed jobs" retries it without republishing to Maven Central. + needs: publish-android + if: needs.publish-android.outputs.published == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 - name: Create GitHub release - # Only when this run actually published a new version, and only from a release branch - if: steps.publish.outputs.published == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') env: GH_TOKEN: ${{ github.token }} - VERSION: ${{ steps.publish.outputs.version }} + VERSION: ${{ needs.publish-android.outputs.version }} run: | if gh release view "$VERSION" > /dev/null 2>&1; then echo "Release $VERSION already exists, skipping."