Skip to content

Commit 8facd56

Browse files
Rafal Maciagclaude
andcommitted
Fix preview version parsing to exclude preview tags
The version parser was including '-preview.X' in the PATCH component when the latest tag was already a preview tag, causing double '-preview' in generated versions. Now: - Only considers stable tags (v*.*.* without -preview) - Strips any non-numeric suffix from PATCH component 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2cdb721 commit 8facd56

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/preview-publish.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,20 @@ jobs:
4242
exit 0
4343
fi
4444
45-
# Get latest tag version
46-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
45+
# Get latest stable tag (exclude preview tags)
46+
LATEST_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | grep -v preview | sort -V | tail -n1 || echo "v0.0.0")
47+
if [ -z "$LATEST_TAG" ]; then
48+
LATEST_TAG="v0.0.0"
49+
fi
4750
VERSION="${LATEST_TAG#v}"
4851
49-
# Parse version components
52+
# Parse version components (only X.Y.Z, no suffixes)
5053
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
5154
MAJOR=${MAJOR:-0}
5255
MINOR=${MINOR:-0}
5356
PATCH=${PATCH:-0}
57+
# Strip any non-numeric suffix from PATCH
58+
PATCH=$(echo "$PATCH" | grep -oE '^[0-9]+' || echo "0")
5459
5560
# Bump patch for preview
5661
PATCH=$((PATCH + 1))

0 commit comments

Comments
 (0)