test: ensure versions are consistent

This commit is contained in:
eric
2026-03-04 18:45:55 +01:00
parent e445e49baf
commit 250882da1f
4 changed files with 143 additions and 2 deletions

View File

@@ -23,11 +23,12 @@ usage() {
" (none) bump patch, keep current channel" \
" major/minor/patch bump the given part, keep current channel" \
" stable / full remove prerelease suffix" \
" __CHANNEL_LIST__ switch channel (bumps prerelease number if same base+channel)" \
" __CHANNEL_LIST__ switch channel (from stable, auto-bumps patch unless bump is specified)" \
"" \
"Examples:" \
" ${cmd} # patch bump on current channel" \
" ${cmd} minor # minor bump on current channel" \
" ${cmd} beta # from stable: patch bump + beta.1" \
" ${cmd} patch beta # patch bump, switch to beta channel" \
" ${cmd} rc # switch to rc channel" \
" ${cmd} stable # promote to stable release" \
@@ -310,7 +311,7 @@ main() {
esac
else
local part="" target_channel=""
local part="" target_channel="" was_channel_only=0
case "$action" in
"") part="patch" ;;
@@ -331,6 +332,7 @@ main() {
if [[ $is_channel == 1 ]]; then
[[ -n ${1-} ]] && echo "Error: channel-only bump takes no second argument" >&2 && usage && exit 1
target_channel="$action"
was_channel_only=1
else
echo "Error: unknown argument '$action'" >&2
usage
@@ -343,6 +345,10 @@ main() {
[[ $target_channel == "full" ]] && target_channel="stable"
validate_channel "$target_channel"
if [[ -z $part && $was_channel_only -eq 1 && $CHANNEL == "stable" && $target_channel != "stable" ]]; then
part="patch"
fi
local old_base="$BASE_VERSION" old_channel="$CHANNEL" old_pre="$PRERELEASE_NUM"
[[ -n $part ]] && bump_base_version "$part"