fix(release): span the final-release changelog since the previous stable tag - #471
Merged
Merged
Conversation
…ble tag Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Auto-promoted final releases publish with an empty changelog (just
## Changelog), while rc/dryrun prereleases get full changelogs.Auto-promote tags the newest candidate's exact commit as the final
vX.Y.Z, sov0.8.0andv0.8.0-rc.7are the same commit (58c3d30).release.yamlruns GoReleaser withGORELEASER_CURRENT_TAGset but notGORELEASER_PREVIOUS_TAG, so GoReleaser auto-detects the previous tag as the immediately preceding semver tag (the candidate, same commit). The compare range is empty, so the changelog is empty. Older finals (v0.7.0) escaped only because commits happened to land between rc and final.Fix
For a final (non-prerelease) current tag, compute the previous non-prerelease tag and pass it as
GORELEASER_PREVIOUS_TAG, so the final changelog spans the whole candidate cycle (for examplev0.7.0..v0.8.0). Prerelease tags (-rc./-dryrun.) leave it unset and keep their incremental changelogs..github/scripts/previous-stable-tag.sh: prints the greatest finalvX.Y.Ztag strictly below a given tag (skipping rc/dryrun), or empty if none. shellcheck clean..github/workflows/release.yaml: a pre-GoReleaser step runs the script for final tags and writesGORELEASER_PREVIOUS_TAGto$GITHUB_ENVonly when non-empty; the checkout already usesfetch-depth: 0and the step alsogit fetch --tags --force.github.ref_nameis passed viaenv:(no shell interpolation).internal/release/previous_stable_tag_test.go: drives the script over injected tag sets (prior stable skips rc/dryrun; only-prereleases-below returns empty; first stable returns empty; multiple stables returns highest below; prerelease current resolves the stable below its base).Verification
shellcheckclean;actionlint .github/workflows/release.yamlclean.go build ./...,go test ./...(2371 passed),golangci-lint run ./...all clean.GORELEASER_CURRENT_TAG=v0.8.0with previous unset or empty string ->previous_tag=v0.8.0-rc.6, changelog is 1 line (empty).GORELEASER_PREVIOUS_TAG=v0.7.0->previous_tag=v0.7.0, 32-line changelog across the cycle.GORELEASER_PREVIOUS_TAGis treated as unset (auto-detect), so passing empty on the prerelease path is safe. The real config useschangelog.use: github(GitHub compare API), for whichGORELEASER_PREVIOUS_TAGis the documented previous-tag override.