From 432fb2118a9522f4c37c65bdf5a3691aa4a8de6f Mon Sep 17 00:00:00 2001 From: Aymeric Rabot Date: Thu, 10 Sep 2026 18:47:15 -0400 Subject: [PATCH] ci(release): graduate prerelease versions on stable bumps The stable-bump path split "1.0.0-beta.5" on dots, so major produced 2.0.0, minor 1.1.0, patch failed on "0-beta" arithmetic, and none would have published a beta version on the latest dist-tag. Any stable bump on a prerelease now yields its base version, matching npm semver, so the 1.0.0-beta.N line can be released as 1.0.0. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0659a8d6..2a1adae01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ on: - cli - all bump: - description: "Version bump (beta publishes a prerelease on the beta dist-tag)" + description: "Version bump (beta publishes a prerelease on the beta dist-tag; patch/minor/major on a prerelease graduates it to its base version on latest)" required: true type: choice options: @@ -120,11 +120,16 @@ jobs: fi return fi + if [ "$BUMP" = "none" ]; then echo "$v"; return; fi + # A prerelease graduates to its base version on any stable bump + # (1.0.0-beta.5 + major|minor|patch -> 1.0.0), matching npm semver. + # Splitting "1.0.0-beta.5" on dots would otherwise yield 2.0.0 or + # break the patch arithmetic. + if [[ "$v" == *-* ]]; then echo "${v%%-*}"; return; fi IFS='.' read -r MAJ MIN PAT <<< "$v" if [ "$BUMP" = "major" ]; then MAJ=$((MAJ+1)); MIN=0; PAT=0; fi if [ "$BUMP" = "minor" ]; then MIN=$((MIN+1)); PAT=0; fi if [ "$BUMP" = "patch" ]; then PAT=$((PAT+1)); fi - if [ "$BUMP" = "none" ]; then echo "$v"; return; fi echo "$MAJ.$MIN.$PAT" }