From 551d8ed69239762cbb6c3f2cdd7a65c4af694dda Mon Sep 17 00:00:00 2001 From: Teg79 Date: Tue, 17 Nov 2026 11:57:15 +0100 Subject: [PATCH] fix(release): build the tag that started the run; a release's changelog from the previous one v0.1.0 was pushed on v0.1.0-rc.1's commit, and GoReleaser picked the rc tag: it built 0.1.0-rc.1 again and failed to upload onto the rc's release. GORELEASER_CURRENT_TAG is now the run's tag, and GORELEASER_PREVIOUS_TAG the previous release without a suffix (or the first commit), so that an rc on the same commit doesn't leave the changelog empty. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0182yxsfwRowwnxCfgrQwjnA --- .github/workflows/release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34ee03f..0779e28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,10 +49,21 @@ jobs: - uses: jdx/mise-action@236a21c3b91f5db6d4e174b348674a0f0caac06d # v5.2.9 with: install_args: go goreleaser + # The tag that started this run, and the one its changelog starts + # from: the previous release without a suffix (an -rc on the same + # commit would leave it empty), or the first commit for the first + # release. Left to itself, GoReleaser picks one of the tags of the + # commit, and v0.1.0 on v0.1.0-rc.1's commit was built as the rc. - name: Build and draft the release - run: goreleaser release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_CURRENT_TAG: ${{ github.ref_name }} + run: | + prev=$({ git tag --list 'v*' | grep -v -e '-'; echo "$GORELEASER_CURRENT_TAG"; } | sort -uV | grep -B1 -x "$GORELEASER_CURRENT_TAG" | head -n 1) + [ "$prev" = "$GORELEASER_CURRENT_TAG" ] && prev= + export GORELEASER_PREVIOUS_TAG=${prev:-$(git rev-list --max-parents=0 HEAD | tail -n 1)} + echo "Releasing $GORELEASER_CURRENT_TAG, changes since $GORELEASER_PREVIOUS_TAG" + goreleaser release --clean - name: Build provenance of the archives uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: