feat: add release candidate (RC) support to release tooling (#23600)

This adds full RC release support to the release scripts and GitHub
Actions workflow. Previously, the tooling only supported stable and
mainline releases with strict vMAJOR.MINOR.PATCH semver tags.

Changes:
- scripts/releaser/version.go: Add Pre field to version struct for
prerelease suffixes (e.g. "rc.0"), update regex, parsing, String(),
comparison methods, and add IsRC()/rcNumber() helpers.
- scripts/releaser/release.go: Detect RC branches (release/X.Y-rc.N),
suggest RC version numbers, auto-set "rc" channel (skipping
stable/mainline prompt), add RC advisory to release notes, skip docs
update for RC releases.
- .github/workflows/release.yaml: Add "rc" channel option, fix branch
derivation for RC tags (v2.32.0-rc.0 -> release/2.32-rc.0 instead of
broken release/2.32.0-rc), skip homebrew/winget/package publishing for
RC releases.
- scripts/release/publish.sh: Add --rc flag, pass --prerelease to gh
release create for RC releases.
- scripts/releaser/version_test.go: Add comprehensive unit tests for
version parsing, string formatting, IsRC, rcNumber, GreaterThan, and
Equal with RC versions.

<!--

If you have used AI to produce some or all of this PR, please ensure you
have read our [AI Contribution
guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING)
before submitting.

-->
This commit is contained in:
Garrett Delfosse
2026-04-01 16:00:49 -04:00
committed by GitHub
parent 83e2699914
commit be2e641162
5 changed files with 324 additions and 44 deletions
+16 -1
View File
@@ -34,11 +34,12 @@ if [[ "${CI:-}" == "" ]]; then
fi
stable=0
rc=0
version=""
release_notes_file=""
dry_run=0
args="$(getopt -o "" -l stable,version:,release-notes-file:,dry-run -- "$@")"
args="$(getopt -o "" -l stable,rc,version:,release-notes-file:,dry-run -- "$@")"
eval set -- "$args"
while true; do
case "$1" in
@@ -46,6 +47,10 @@ while true; do
stable=1
shift
;;
--rc)
rc=1
shift
;;
--version)
version="$2"
shift 2
@@ -68,6 +73,10 @@ while true; do
esac
done
if [[ "$stable" == 1 ]] && [[ "$rc" == 1 ]]; then
error "Cannot specify both --stable and --rc"
fi
# Check dependencies
dependencies gh
@@ -162,6 +171,11 @@ if [[ "$stable" == 1 ]]; then
latest=true
fi
prerelease_flag=()
if [[ "$rc" == 1 ]]; then
prerelease_flag=(--prerelease)
fi
target_commitish=main # This is the default.
# Skip during dry-runs
if [[ "$dry_run" == 0 ]]; then
@@ -176,6 +190,7 @@ fi
true |
maybedryrun "$dry_run" gh release create \
--latest="$latest" \
"${prerelease_flag[@]}" \
--title "$new_tag" \
--target "$target_commitish" \
--notes-file "$release_notes_file" \