fix(release): bump-version handles a pre-release CURRENT version

The package.json + android versionName seds matched only a clean X.Y.Z, so bumping FROM a
pre-release (1.9.1-beta1 -> 1.9.1-beta2) left those two files stale while VERSION advanced -
an inconsistent release. Allow a [^"]* suffix so the current value's -beta1 is matched and
replaced. Still matches clean versions (regression-checked).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ScreenTinker 2026-06-14 20:33:37 -05:00
parent fbd466b7f2
commit a21843818c

View file

@ -33,12 +33,15 @@ echo "Bumping $CURRENT -> $NEW"
printf '%s\n' "$NEW" > VERSION printf '%s\n' "$NEW" > VERSION
# 2) server/package.json version + lockfile (only the top-level "version" key; # 2) server/package.json version + lockfile (only the top-level "version" key;
# dependency entries are "name": "^x.y.z" and won't match "version": "x.y.z") # dependency entries are "name": "^x.y.z" and won't match "version": "x.y.z").
sed -i -E "s/(\"version\"[[:space:]]*:[[:space:]]*)\"[0-9]+\.[0-9]+\.[0-9]+\"/\1\"$NEW\"/" server/package.json # The [^"]* tail also matches a pre-release CURRENT value (e.g. 1.9.1-beta1) so a
# beta1->beta2 bump replaces it instead of silently no-op'ing (issue: stale package.json).
sed -i -E "s/(\"version\"[[:space:]]*:[[:space:]]*)\"[0-9]+\.[0-9]+\.[0-9]+[^\"]*\"/\1\"$NEW\"/" server/package.json
( cd server && npm install --package-lock-only >/dev/null ) ( cd server && npm install --package-lock-only >/dev/null )
# 3) android versionName + versionCode (+1) # 3) android versionName + versionCode (+1). [0-9][^"]* matches a pre-release current
sed -i -E "s/(versionName[[:space:]]*=[[:space:]]*)\"[0-9.]+\"/\1\"$NEW\"/" android/app/build.gradle.kts # value too (e.g. 1.9.1-beta1), so beta1->beta2 actually replaces it.
sed -i -E "s/(versionName[[:space:]]*=[[:space:]]*)\"[0-9][^\"]*\"/\1\"$NEW\"/" android/app/build.gradle.kts
CODE="$(grep -oE 'versionCode[[:space:]]*=[[:space:]]*[0-9]+' android/app/build.gradle.kts | grep -oE '[0-9]+$')" CODE="$(grep -oE 'versionCode[[:space:]]*=[[:space:]]*[0-9]+' android/app/build.gradle.kts | grep -oE '[0-9]+$')"
sed -i -E "s/(versionCode[[:space:]]*=[[:space:]]*)[0-9]+/\1$((CODE + 1))/" android/app/build.gradle.kts sed -i -E "s/(versionCode[[:space:]]*=[[:space:]]*)[0-9]+/\1$((CODE + 1))/" android/app/build.gradle.kts