Skip to content

Commit b44d8cc

Browse files
committed
fix: releases
1 parent 10b0611 commit b44d8cc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ jobs:
3939
- name: Get next version
4040
id: get_version
4141
run: |
42-
# Get the latest tag
43-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
44-
echo "Latest tag: $LATEST_TAG"
42+
# Get all tags and sort by version number (descending)
43+
LATEST_TAG=$(git tag -l | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^v//' | sort -t. -k1,1nr -k2,2nr -k3,3nr | head -n1)
44+
45+
# If no tags found, default to 0.0.0
46+
if [ -z "$LATEST_TAG" ]; then
47+
LATEST_TAG="0.0.0"
48+
fi
4549
46-
# Extract version numbers (remove 'v' prefix)
47-
VERSION_NUM=${LATEST_TAG#v}
50+
echo "Latest tag: $LATEST_TAG"
4851
4952
# Split version into parts
50-
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM"
53+
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG"
5154
5255
# Default to 0 if parts are empty
5356
MAJOR=${MAJOR:-0}

0 commit comments

Comments
 (0)