From 1a3147b4201e2f125d9fd8d1b9bc9958d8f23bd8 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 20 Jul 2025 19:50:23 +0300 Subject: [PATCH] Add check-version.sh script --- check-version.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 check-version.sh diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..10c5e2a --- /dev/null +++ b/check-version.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Gitlab repository +REPO="xorg/app/xkbutils" + +# Replace slash with URL encoded representation +REPO=$(echo "$REPO" | sed 's|/|%2F|g') + +# 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 '-gitlab' suffix +TAG_NAME=$(echo "$TAG_NAME" | sed 's/-gitlab//g') + +# Get version number from tag name +VERSION=$(echo "$TAG_NAME" | rev | cut -d'-' -f1 | rev) + +# Trim 'v' character in VERSION variable +VERSION=$(echo "$VERSION" | tr -d 'v') + +echo "$VERSION"