Skip to content

Instantly share code, notes, and snippets.

@khbecker
Forked from FrozenCow/update.sh
Last active January 12, 2016 18:07
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 khbecker/fa48b29aeb523f0a0689 to your computer and use it in GitHub Desktop.
Save khbecker/fa48b29aeb523f0a0689 to your computer and use it in GitHub Desktop.
Update PKGBUILD for itch with new pkgver based on Github releases
#!/bin/sh
# 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
# 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