Skip to content

Commit 2eed8ea

Browse files
fix(release): repair invalid 0.4.12+ bump and harden auto-bump
Auto Version Bump mishandled lettered versions like 0.4.11-b and wrote an empty build number. Set main to 0.4.12+1 and strip pre-release suffixes before bumping.
1 parent 8decc5b commit 2eed8ea

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/version-bump.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,20 @@ jobs:
3434
if: steps.check.outputs.merged == 'true'
3535
id: current_version
3636
run: |
37-
CURRENT_VERSION=$(grep "^version:" pubspec.yaml | sed 's/version: //' | sed 's/+.*//')
38-
BUILD_NUMBER=$(grep "^version:" pubspec.yaml | sed 's/.*+//')
39-
echo "current_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
40-
echo "current_build=$BUILD_NUMBER" >> "$GITHUB_OUTPUT"
37+
LINE=$(grep "^version:" pubspec.yaml | sed 's/^version:[[:space:]]*//')
38+
# Drop +build, then any -prerelease (e.g. 0.4.11-b → 0.4.11).
39+
CORE=$(echo "$LINE" | sed 's/+.*//; s/-.*//')
40+
if [[ "$LINE" == *'+'* ]]; then
41+
BUILD="${LINE##*+}"
42+
else
43+
BUILD=""
44+
fi
45+
# Guard against non-numeric build leftovers.
46+
if ! [[ "$BUILD" =~ ^[0-9]+$ ]]; then
47+
BUILD=""
48+
fi
49+
echo "current_version=$CORE" >> "$GITHUB_OUTPUT"
50+
echo "current_build=$BUILD" >> "$GITHUB_OUTPUT"
4151
4252
- name: Bump patch version
4353
if: steps.check.outputs.merged == 'true'
@@ -48,6 +58,10 @@ jobs:
4858
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
4959
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
5060
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
61+
if ! [[ "$MAJOR$MINOR$PATCH" =~ ^[0-9]+$ ]]; then
62+
echo "Invalid core version: $CURRENT_VERSION" >&2
63+
exit 1
64+
fi
5165
NEW_PATCH=$((PATCH + 1))
5266
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
5367
if [ -z "$CURRENT_BUILD" ]; then

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: querya_desktop
22
description: Lightweight desktop SQL/NoSQL client. Flutter (Dart).
3-
version: 0.4.12+
3+
version: 0.4.12+1
44

55

66

0 commit comments

Comments
 (0)