Fix detection for weird tags

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-04-13 18:41:32 +02:00
parent 8437ac7731
commit bd7536e103
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -5,19 +5,20 @@ PKG=$(awk -F '=' '/^pkgname=/{ print $2 }' PKGBUILD)
# Get latest version # Get latest version
VER=$(git ls-remote --tags --sort -v:refname https://github.com/mvdan/gofumpt.git | VER=$(git ls-remote --tags --sort -v:refname https://github.com/mvdan/gofumpt.git |
head -n1 | grep -E '/tags/v[0-9.]+$' |
grep -Eo '[0-9.]+$') head -n1 |
grep -Eo '[0-9.]+$')
# Insert latest version into PKGBUILD and update hashes # Insert latest version into PKGBUILD and update hashes
sed -i \ sed -i \
-e "s/^pkgver=.*/pkgver=${VER}/" \ -e "s/^pkgver=.*/pkgver=${VER}/" \
-e 's/pkgrel=.*/pkgrel=1/' \ -e 's/pkgrel=.*/pkgrel=1/' \
PKGBUILD PKGBUILD
# Check whether this changed anything # Check whether this changed anything
if (git diff --exit-code PKGBUILD); then if (git diff --exit-code PKGBUILD); then
echo "Package ${PKG} has most recent version ${VER}" echo "Package ${PKG} has most recent version ${VER}"
exit 0 exit 0
fi fi
updpkgsums updpkgsums