From ec02725e1e69947460fa1018f05393c38f3b5713 Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Mon, 16 Nov 2026 11:38:04 -0700 Subject: [PATCH] Separate release validation from publication workflows --- .github/scripts/release.sh | 2 +- .github/workflows/README.md | 15 ++++++-- .github/workflows/release-validation.yml | 49 ++++++++++++++++++++++++ .github/workflows/release.yml | 33 +++++----------- 4 files changed, 72 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/release-validation.yml diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index 8c41a7d555..91f218bb22 100755 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -211,7 +211,7 @@ candidate() { write_output prerelease "$([[ "$version" == *-RC* ]] && echo true || echo false)" } -# Tests the project and verifies its primary local Maven publication. +# Builds the project without running tests and verifies its primary local Maven publication. build_maven() { require RELEASE_COMMIT require RELEASE_VERSION diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 0fd75cf7bc..8de55fc134 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -2,17 +2,26 @@ ## Releases -[`release.yml`](release.yml) publishes a release from an exact commit after a -release pull request is merged. Normal releases require two human decisions: +[`release-validation.yml`](release-validation.yml) validates changelog changes +on pull requests. It has no release build or publication jobs. + +[`release.yml`](release.yml) builds and publishes releases after a release pull +request is merged, or when started manually. It does not run on pull requests. +Normal releases require two human decisions: 1. Review and merge a pull request that promotes the desired entries from the `CHANGELOG.md` `[Unreleased]` section into one new `## [X.Y.Z] - YYYY-MM-DD` section. 2. Approve the `release-publication` GitHub environment after the workflow has - tested the Maven publications and built the native test server executables. + verified the local Maven artifacts and built the native test server executables. Approval must be given within 30 days or GitHub automatically fails the waiting job. +The **Build and verify local Maven artifacts** job builds artifacts in a temporary +Maven repository on the runner and verifies the generated POM. It does not run +SDK tests or publish to Maven Central. SDK tests remain in the normal +Continuous Integration workflow. + The protected `publish` job depends on both validation paths, so GitHub does not request approval until they succeed. GitHub marks the job as **Waiting** and sends the configured required reviewers a deployment review notification; diff --git a/.github/workflows/release-validation.yml b/.github/workflows/release-validation.yml new file mode 100644 index 0000000000..e622617e9b --- /dev/null +++ b/.github/workflows/release-validation.yml @@ -0,0 +1,49 @@ +name: Release validation + +defaults: + run: + shell: bash -euo pipefail {0} + +on: + pull_request: + branches: [main, "releases/**", "v*.*.x", "*.*.x", "release_*_*_x"] + paths: + - CHANGELOG.md + - .github/scripts/release.sh + - .github/workflows/release-validation.yml + - .github/workflows/release.yml + +permissions: + contents: read + +jobs: + candidate: + name: Resolve release candidate + runs-on: ubuntu-latest + steps: + - name: Checkout candidate + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Validate changelog transition + id: metadata + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + EVENT_NAME: ${{ github.event_name }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: .github/scripts/release.sh candidate "$RUNNER_TEMP/release-notes.md" + + - name: Summarize candidate + if: steps.metadata.outputs.release == 'true' + env: + RELEASE_COMMIT: ${{ steps.metadata.outputs.commit }} + RELEASE_TAG: ${{ steps.metadata.outputs.tag }} + run: | + { + echo "## Release candidate" + echo + echo "- Tag: \`$RELEASE_TAG\`" + echo "- Commit: \`$RELEASE_COMMIT\`" + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1661e4c24b..fea13b9dd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,9 +5,6 @@ defaults: shell: bash -euo pipefail {0} on: - pull_request: - branches: [main, "releases/**", "v*.*.x", "*.*.x", "release_*_*_x"] - paths: [CHANGELOG.md] push: branches: [main, "releases/**", "v*.*.x", "*.*.x", "release_*_*_x"] paths: [CHANGELOG.md] @@ -42,23 +39,21 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + ref: ${{ github.sha }} - name: Validate changelog transition id: metadata env: - BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + BASE_SHA: ${{ github.event.before }} EVENT_NAME: ${{ github.event_name }} - HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + HEAD_SHA: ${{ github.sha }} MANUAL_DRAFT_RELEASE: ${{ inputs.draft_release }} MANUAL_REF: ${{ github.ref_name }} MANUAL_VERSION: ${{ inputs.version }} run: .github/scripts/release.sh candidate "$RUNNER_TEMP/release-notes.md" - name: Upload exact release notes - if: >- - (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - steps.metadata.outputs.release == 'true' + if: steps.metadata.outputs.release == 'true' uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: release-notes-${{ steps.metadata.outputs.commit }} @@ -81,10 +76,8 @@ jobs: } >> "$GITHUB_STEP_SUMMARY" build_maven: - name: Test and inspect Maven publications - if: >- - (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - needs.candidate.outputs.release == 'true' + name: Build and verify local Maven artifacts + if: needs.candidate.outputs.release == 'true' needs: candidate runs-on: ubuntu-latest timeout-minutes: 90 @@ -105,7 +98,7 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@ac396bf1a80af16236baf54bd7330ae21dc6ece5 # v6 - - name: Test and inspect Maven publications + - name: Build and verify local Maven artifacts env: RELEASE_COMMIT: ${{ needs.candidate.outputs.commit }} RELEASE_VERSION: ${{ needs.candidate.outputs.version }} @@ -115,9 +108,7 @@ jobs: build_native: name: Build native test server - if: >- - (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - needs.candidate.outputs.release == 'true' + if: needs.candidate.outputs.release == 'true' needs: candidate uses: ./.github/workflows/build-native-image.yml with: @@ -127,9 +118,7 @@ jobs: package_native: name: Package native release assets - if: >- - (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - needs.candidate.outputs.release == 'true' + if: needs.candidate.outputs.release == 'true' needs: [candidate, build_native] runs-on: ubuntu-latest permissions: @@ -164,9 +153,7 @@ jobs: publish: name: Publish ${{ needs.candidate.outputs.tag }} - if: >- - (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - needs.candidate.outputs.release == 'true' + if: needs.candidate.outputs.release == 'true' needs: [candidate, build_maven, package_native] runs-on: ubuntu-latest timeout-minutes: 150