Update check-version.sh script
This commit is contained in:
+7
-8
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user