ci: Fix latest tag detection to exclude dev tags

This commit is contained in:
Paul Gauthier (aider) 2025-04-01 21:14:24 +13:00
parent 0a840860f1
commit 60859ec2b9

View file

@ -55,13 +55,23 @@ jobs:
- name: Get latest tag
id: latest_tag
run: |
set -x # Enable debugging output
# Fetch all tags from remote just in case
git fetch --tags origin main
# Get the latest tag that looks like vX.Y.Z (no 'dev')
latest_tag=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n 1)
# Get the latest tag that strictly matches vX.Y.Z (no suffixes like .dev)
# List all tags, sort by version descending, filter for exact pattern, take the first one
latest_tag=$(git tag --sort=-v:refname | grep -P '^v\d+\.\d+\.\d+$' | head -n 1)
if [ -z "$latest_tag" ]; then
echo "Error: Could not find any tags matching the pattern '^v\d+\.\d+\.\d+$'"
exit 1
fi
echo "Latest non-dev tag: $latest_tag"
# Remove 'v' prefix for comparison
echo "tag=${latest_tag#v}" >> $GITHUB_OUTPUT
tag_num=${latest_tag#v}
echo "Extracted tag number: $tag_num"
echo "tag=$tag_num" >> $GITHUB_OUTPUT
- name: Compare versions
run: |