Skip to content

Commit babcdb5

Browse files
committed
feat: enhance tag comparison logic to exclude dev tags on main branch
1 parent fc2d405 commit babcdb5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/workflows/build-and-release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ jobs:
232232
NEW_TAG="${{ needs.build.outputs.tag }}"
233233
234234
# Get all matching tags, exclude the new tag if it exists, and get the latest
235-
PREVIOUS_TAG=$(git tag -l "${TAG_PATTERN}" | grep -v "^${NEW_TAG}$" | sort -V | tail -n1)
235+
# For main branch, also exclude dev tags (v-dev-*) to prevent incorrect comparisons
236+
if [ "$BRANCH_NAME" = "main" ]; then
237+
PREVIOUS_TAG=$(git tag -l "${TAG_PATTERN}" | grep -v "^${NEW_TAG}$" | grep -v "^v-.*-" | sort -V | tail -n1)
238+
else
239+
PREVIOUS_TAG=$(git tag -l "${TAG_PATTERN}" | grep -v "^${NEW_TAG}$" | sort -V | tail -n1)
240+
fi
236241
237242
if [ -z "$PREVIOUS_TAG" ]; then
238243
echo "No previous tag found, showing last 20 commits"

0 commit comments

Comments
 (0)