Update check-version.sh script

This commit is contained in:
2026-01-10 16:44:30 +02:00
parent 89eb41ce80
commit 17aa4e6bc1
+4 -7
View File
@@ -1,13 +1,10 @@
#!/bin/bash #!/bin/bash
# Gitlab repository # Git repository
REPO="libvirt/libvirt" REPO="https://gitlab.com/libvirt/libvirt.git"
# Replace slash with URL encoded representation # Get tag name using 'git ls-remote'
REPO=$(echo "$REPO" | sed 's|/|%2F|g') TAG_NAME=$(git ls-remote --exit-code --refs --tags --sort='v:refname' "$REPO" | cut -d'/' -f3 | grep -E '^v[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$' | tail -n1)
# Get tag name using Gitlab Rest API
TAG_NAME=$(curl -s -L https://gitlab.com/api/v4/projects/"$REPO"/repository/tags | jq -r '.[].name' | grep '^v' | grep -v 'rc' | head -n1)
# Trim 'v' character in TAG_NAME variable # Trim 'v' character in TAG_NAME variable
VERSION=$(echo "$TAG_NAME" | tr -d 'v') VERSION=$(echo "$TAG_NAME" | tr -d 'v')