scripts/bump-fork.sh: derive BRANCH_VERSION from git branch

The script uses '${BRANCH_VERSION:-0.0.0}' as the +rb suffix when
bumping a fork to a new upstream version. BRANCH_VERSION was never
set, so any fork bump would have produced 'X.Y.Z+rb0.0.0' instead
of the correct 'X.Y.Z+rb0.3.2' (or whichever branch is current).

Derive BRANCH_VERSION from 'git branch --show-current' using the same
pattern as local/scripts/build-redbear.sh:158-165. Falls back to
'0.0.0' if the branch name doesn't match semver (e.g., on 'master').

(NO AI attribution)
This commit is contained in:
2026-07-14 11:53:39 +09:00
parent 314f655f37
commit 137da99644
+8
View File
@@ -11,6 +11,14 @@
set -euo pipefail
# Derive Red Bear OS version from the current git branch name.
# Branch "0.3.1" → BRANCH_VERSION="0.3.1". Same pattern as
# local/scripts/build-redbear.sh:158-165. Falls back to "0.0.0" if
# the branch name doesn't match semver.
BRANCH_VERSION=$(git -C "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" branch --show-current 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
BRANCH_VERSION="${BRANCH_VERSION:-0.0.0}"
export BRANCH_VERSION
COMPONENT="${1:-}"
if [[ -z "$COMPONENT" ]]; then
echo "Usage: $0 <component> [--version=X.Y.Z]"