Skip to content

Commit 668b5d6

Browse files
committed
Fix empty tag handling in version parsing
Use proper empty string check instead of default fallback
1 parent f79f268 commit 668b5d6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ jobs:
2323
- name: Get next version
2424
id: version
2525
run: |
26-
LATEST_TAG=$(git tag --sort=-version:refname | grep "^v[0-9]" | head -n1 || echo "v0.0.0")
27-
echo "Latest tag: $LATEST_TAG"
28-
VERSION=${LATEST_TAG#v}
26+
# Get the latest version tag or set default
27+
LATEST_TAG=$(git tag --sort=-version:refname | grep "^v[0-9]" | head -n1)
28+
echo "Latest tag found: '$LATEST_TAG'"
2929
30-
# Handle case where no tags exist yet
31-
if [ "$VERSION" = "0.0.0" ]; then
30+
# If no tags exist, start with v0.0.1
31+
if [ -z "$LATEST_TAG" ]; then
3232
NEW_TAG="v0.0.1"
3333
else
34+
VERSION=${LATEST_TAG#v}
3435
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
3536
PATCH=$((PATCH + 1))
3637
NEW_TAG="v$MAJOR.$MINOR.$PATCH"

0 commit comments

Comments
 (0)