build(release): compare final changelog against previous stable tag
This commit is contained in:
@@ -41,6 +41,28 @@ jobs:
|
||||
with:
|
||||
go-version-file: src/go.mod
|
||||
|
||||
- name: Select Previous Stable Tag For Final Releases
|
||||
run: |
|
||||
current_tag="${GITHUB_REF_NAME}"
|
||||
if [[ "$current_tag" == *-* ]]; then
|
||||
echo "prerelease tag detected: $current_tag"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
previous_stable_tag="$(
|
||||
git tag --list 'v*' --sort=-version:refname |
|
||||
grep -Fxv "$current_tag" |
|
||||
grep -Ev -- '-' |
|
||||
head -n 1
|
||||
)"
|
||||
|
||||
if [[ -n "$previous_stable_tag" ]]; then
|
||||
echo "using previous stable tag: $previous_stable_tag"
|
||||
echo "GORELEASER_PREVIOUS_TAG=$previous_stable_tag" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "no previous stable tag found"
|
||||
fi
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
|
||||
+1
-1
@@ -67,4 +67,4 @@ The resulting artifacts will be generated under `src/dist/`.
|
||||
|
||||
If you use tags like `v1.2.3-rc1`, GoReleaser will mark the GitHub release as a prerelease.
|
||||
|
||||
If you want the final `v1.2.3` release notes to compare cleanly against the previous stable release, avoid keeping old `rc` tags around longer than needed.
|
||||
For a final tag like `v1.2.3`, the release workflow forces GoReleaser to compare against the previous stable tag instead of the latest `rc` tag. This keeps the final changelog focused on stable-to-stable changes.
|
||||
|
||||
Reference in New Issue
Block a user