Skip to content

Instantly share code, notes, and snippets.

@FrozenCow
Last active December 18, 2015 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FrozenCow/335f394780cbfe26fca1 to your computer and use it in GitHub Desktop.
Save FrozenCow/335f394780cbfe26fca1 to your computer and use it in GitHub Desktop.
Update PKGBUILD with new pkgver based on Github releases
#!/bin/sh
set -o errexit
source ./PKGBUILD
OLDVERSION="$pkgver"
NEWVERSION=$(curl -sS https://api.github.com/repos/itchio/itch/releases | jq -r '.[0].tag_name | match("^v(\\d+(\\.\\d+)+)$"; "g").captures[0].string')
echo "previous version: $OLDVERSION"
echo "latest version: $NEWVERSION"
if [ "$OLDVERSION" = "$NEWVERSION" ]
then
echo "no update available"
exit 1
fi
sed -i "s/pkgver=.*/pkgver=$NEWVERSION/g" PKGBUILD
updpkgsums
namcap -i PKGBUILD
makepkg -s -f
namcap "$pkgname-$pkgver-$pkgrel-$(uname -m).pkg.tar.xz"
mksrcinfo
git add PKGBUILD .SRCINFO
git commit -m "$OLDVERSION -> $NEWVERSION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment