Skip to content

Commit 47e4d16

Browse files
committed
fix: improve version detection to exclude pre-release tags
1 parent 7ac422f commit 47e4d16

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/version-bump.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@ jobs:
3838
- name: Get current version
3939
id: current_version
4040
run: |
41-
# Get the latest release tag (exclude pre-release tags)
42-
LATEST_TAG=$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 || echo "v0.0.0")
41+
# Get the latest release tag (exclude pre-release/dev tags)
42+
# Only match tags that are exactly v{major}.{minor}.{patch}
43+
LATEST_TAG=$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
44+
4345
if [ -z "$LATEST_TAG" ]; then
46+
echo "No existing semver tags found, starting from v0.0.0"
4447
LATEST_TAG="v0.0.0"
4548
fi
46-
echo "Latest tag: ${LATEST_TAG}"
49+
50+
echo "Latest release tag: ${LATEST_TAG}"
51+
echo "Ignoring any dev/pre-release tags"
4752
4853
# Remove 'v' prefix
4954
VERSION=${LATEST_TAG#v}

0 commit comments

Comments
 (0)