fix(release-cut): anchor RC base to latest_stable + patch (#1163)

The rc branch previously derived the base version from the highest
git tag, which reopened an already-shipped series: after v1.3.21
stable was published, cutting an RC still produced v1.3.21-rc.N.
Anchor RCs to latest_stable + patch so a fresh RC after v1.3.21
correctly resolves to v1.3.22-rc.0. Minor/major RCs are cut by
running that stable kind first, which is a clearer workflow than
the old heuristic.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Neil 2026-04-27 00:09:27 -07:00 committed by GitHub
parent 8347b3099d
commit aac395dbff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 17 deletions

View File

@ -103,15 +103,6 @@ jobs:
latest_stable="${latest_stable#v}"
echo "Latest stable: ${latest_stable:-<none>}"
# Latest tag of any kind on the repo (including RCs). Used only
# when kind=rc to figure out the current RC series base.
latest_tag="$(git tag --sort=-v:refname | head -n 1 || true)"
latest_tag="${latest_tag#v}"
echo "Latest tag: ${latest_tag:-<none>}"
# Strip any existing -rc.N suffix for base-version math.
base_of() { echo "${1%%-rc.*}"; }
semver_gt() {
# returns 0 if $1 > $2 by semver rules (ignoring prerelease)
node -e '
@ -159,14 +150,15 @@ jobs:
case "$KIND" in
rc)
# Why: an RC continues the current series if there is one,
# otherwise starts a new series on the next patch version.
# This keeps the "I just want another RC" case one click.
if [[ -n "$latest_tag" && "$latest_tag" == *"-rc."* ]]; then
base="$(base_of "$latest_tag")"
else
base="$(bump "$latest_stable" patch)"
fi
# Why: RCs always stabilize the *next* patch after whatever
# is currently published as stable. Earlier logic tried to
# "continue the current series" by reading the highest git
# tag, which silently reopened a series that had already
# shipped (e.g. cutting v1.3.21-rc.7 after v1.3.21 stable
# was out). Anchoring to latest_stable + patch eliminates
# that class of bug; minor/major RCs are cut by running
# that stable kind first.
base="$(bump "$latest_stable" patch)"
new="$(next_rc_in_series "$base")"
;;
patch|minor|major)