Skip to content

Commit f96871b

Browse files
committed
Update incrementation logic for pre-release
1 parent e9ff0b8 commit f96871b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/pre-release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,29 @@ jobs:
3737
BRANCH_NAME="${{ github.ref_name }}"
3838
3939
# Find the latest pre-release tag for this branch pattern
40+
# Look for tags in format: v*-branch.* or *-branch.*
4041
LATEST_TAG=$(git tag -l "*-${BRANCH_NAME}.*" --sort=-version:refname | head -n1)
4142
43+
echo "🔍 Looking for existing tags with pattern: *-${BRANCH_NAME}.*"
44+
echo "📋 All matching tags:"
45+
git tag -l "*-${BRANCH_NAME}.*" --sort=-version:refname || echo "No matching tags found"
46+
echo "🏷️ Latest tag found: ${LATEST_TAG:-'(none)'}"
47+
4248
if [ -z "$LATEST_TAG" ]; then
4349
# No previous pre-release found, start with 1
4450
PRE_RELEASE_NUMBER="1"
51+
echo "✨ No previous pre-release found, starting with ${BRANCH_NAME}.1"
4552
else
46-
# Extract number from tag (format: something-alt.X)
53+
# Extract number from tag (format: v1.2.3-alt.X or 1.2.3-alt.X)
4754
CURRENT_NUMBER=$(echo "$LATEST_TAG" | grep -o "\-${BRANCH_NAME}\.[0-9]\+" | sed "s/-${BRANCH_NAME}\.//")
4855
if [ -z "$CURRENT_NUMBER" ]; then
4956
# Fallback if pattern doesn't match
5057
PRE_RELEASE_NUMBER="1"
58+
echo "⚠️ Could not extract number from tag, falling back to ${BRANCH_NAME}.1"
5159
else
5260
# Increment the number
5361
PRE_RELEASE_NUMBER=$((CURRENT_NUMBER + 1))
62+
echo "🔢 Found existing ${BRANCH_NAME}.${CURRENT_NUMBER}, incrementing to ${BRANCH_NAME}.${PRE_RELEASE_NUMBER}"
5463
fi
5564
fi
5665
@@ -70,6 +79,14 @@ jobs:
7079
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
7180
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
7281
82+
echo ""
83+
echo "📦 Version Summary:"
84+
echo " Base version: $BASE_VERSION"
85+
echo " Branch: $BRANCH_NAME"
86+
echo " Pre-release number: $PRE_RELEASE_NUMBER"
87+
echo " New version: $NEW_VERSION"
88+
echo " Tag will be: v$NEW_VERSION"
89+
echo ""
7390
echo "✅ Updated version from $BASE_VERSION to $NEW_VERSION"
7491
7592
- name: Build extension

0 commit comments

Comments
 (0)