From a21843818c01f8fc160582346d0c7989cbf80ddd Mon Sep 17 00:00:00 2001 From: ScreenTinker Date: Sun, 14 Jun 2026 20:33:37 -0500 Subject: [PATCH] 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) --- scripts/bump-version.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 04c1c71..4b2e510 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -33,12 +33,15 @@ echo "Bumping $CURRENT -> $NEW" printf '%s\n' "$NEW" > VERSION # 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") -sed -i -E "s/(\"version\"[[:space:]]*:[[:space:]]*)\"[0-9]+\.[0-9]+\.[0-9]+\"/\1\"$NEW\"/" server/package.json +# dependency entries are "name": "^x.y.z" and won't match "version": "x.y.z"). +# 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 ) -# 3) android versionName + versionCode (+1) -sed -i -E "s/(versionName[[:space:]]*=[[:space:]]*)\"[0-9.]+\"/\1\"$NEW\"/" android/app/build.gradle.kts +# 3) android versionName + versionCode (+1). [0-9][^"]* matches a pre-release current +# 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]+$')" sed -i -E "s/(versionCode[[:space:]]*=[[:space:]]*)[0-9]+/\1$((CODE + 1))/" android/app/build.gradle.kts