diff --git a/check-version.sh b/check-version.sh index 2002b61..beff2c7 100644 --- a/check-version.sh +++ b/check-version.sh @@ -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"