From 08917e4ca510cb206eef5b75dc2fdec6abce12ff Mon Sep 17 00:00:00 2001 From: Aditya Agarwal Date: Fri, 1 May 2026 18:20:15 +0200 Subject: [PATCH] chore(ci): split release into prepare and publish jobs Split release workflow into a prepare stage (version resolution and tests) and a publish stage so release publication can be retried without rerunning preparation. Co-authored-by: Cursor --- .github/workflows/release.yml | 37 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05b51b8..c7d0f9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,24 +7,43 @@ on: - main jobs: - Release: - name: 🚀 Release + prepare_release: + name: Prepare release if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-') runs-on: ubuntu-latest + outputs: + version: ${{ steps.release_meta.outputs.version }} + tag: ${{ steps.release_meta.outputs.tag }} steps: - uses: actions/checkout@v4 - - uses: actions/github-script@v6 + - name: Resolve release version + id: release_meta + run: | + VERSION="${GITHUB_HEAD_REF#release-}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "tag=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Set up Go + uses: actions/setup-go@v5 with: - script: | - // Getting the release version from the PR source branch - // Source branch looks like this: release-1.0.0 - const version = context.payload.pull_request.head.ref.split('-')[1] - core.exportVariable('VERSION', version) + go-version: "1.23" + + - name: Run tests + env: + STREAM_BASE_URL: ${{ vars.STREAM_BASE_URL }} + STREAM_API_KEY: ${{ vars.STREAM_API_KEY }} + STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }} + run: go test -short -v ./... + publish_release: + name: Publish release + needs: prepare_release + runs-on: ubuntu-latest + steps: - name: Create release on GitHub uses: ncipollo/release-action@v1 with: - tag: ${{ env.VERSION }} + tag: ${{ needs.prepare_release.outputs.tag }} token: ${{ secrets.GITHUB_TOKEN }} generateReleaseNotes: true