Update check-version.sh script

This commit is contained in:
2026-07-16 16:04:11 +03:00
parent 7b84a5e9e4
commit a45c4a1d28
+7 -8
View File
@@ -1,15 +1,14 @@
#!/bin/bash
# Gitlab repository
REPO="spice/spice-gtk"
URL="https://spice-space.org/download/gtk"
# Replace slash with URL encoded representation
REPO=$(echo "$REPO" | sed 's|/|%2F|g')
# Get version number from tag name
VERSION=$(curl -s -L "$URL" | grep -o -P 'spice-gtk-\d\.\d+.tar.xz' | tail -n1)
# Get tag name using Gitlab Rest API
TAG_NAME=$(curl -s -L https://gitlab.freedesktop.org/api/v4/projects/"$REPO"/repository/tags | jq -r '.[0].name')
# Trim prefix
VERSION=${VERSION//spice-gtk-}
# Trim 'v' character in TAG_NAME variable
VERSION=$(echo "$TAG_NAME" | tr -d 'v')
# Trim suffix
VERSION=${VERSION//.tar.xz}
echo "$VERSION"