From 03274cf2ea528311bd675524cf6d3696e3cd4116 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 20 Aug 2020 10:58:35 +0200 Subject: [PATCH] Add version-update script Signed-off-by: Knut Ahlers --- update_version.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 update_version.sh diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 0000000..e9853db --- /dev/null +++ b/update_version.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -euxo pipefail + +PKG=$(awk -F '=' '/^pkgname=/{ print $2 }' PKGBUILD) + +# Get latest version +VER=$(git ls-remote --tags --sort -v:refname https://github.com/librespeed/speedtest-cli.git | + head -n1 | + grep -Eo '[0-9.]+$') + +# Insert latest version into PKGBUILD and update hashes +sed -i \ + -e "s/^pkgver=.*/pkgver=${VER}/" \ + -e 's/pkgrel=.*/pkgrel=1/' \ + PKGBUILD + +# Check whether this changed anything +if (git diff --exit-code PKGBUILD); then + echo "Package ${PKG} has most recent version ${VER}" + exit 0 +fi + +updpkgsums + +# Update .SRCINFO +makepkg --printsrcinfo >.SRCINFO + +# Commit changes +git add PKGBUILD .SRCINFO +git commit -m "${PKG} v${VER}"