Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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