Skip to content

Instantly share code, notes, and snippets.

@fasterthanlime
Forked from khbecker/update-itch.sh
Created January 12, 2016 18:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasterthanlime/0dd920ffb42f80b4c88c to your computer and use it in GitHub Desktop.
Save fasterthanlime/0dd920ffb42f80b4c88c to your computer and use it in GitHub Desktop.
Update PKGBUILD for itch with new pkgver based on Github releases
#!/bin/sh -xe
# update-itch.sh
#
# Required packages: jq and pkgbuild-introspection
source ./PKGBUILD
OLDVERSION="$pkgver"
echo "Old Version: ${OLDVERSION}"
NEWVERSION=$(curl https://api.github.com/repos/itchio/itch/releases 2> /dev/null | jq -r '.[0].tag_name | match("\\d(\\.\\d+)+").string')
echo "New Version: ${NEWVERSION}"
if [ "$OLDVERSION" = "$NEWVERSION" ]; then
echo "No update available, exiting..."
exit 1
fi
sed -i "s/pkgver=.*/pkgver=${NEWVERSION}/g" PKGBUILD
makepkg -s -f --skipinteg
# Uncomment the lines below if you want to make and commit a SRCINFO file
mksrcinfo
updpkgsums
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