Add update.sh

This commit is contained in:
relrel 2020-11-20 16:42:33 +00:00
parent d5dbaff015
commit c7ff4410c2
2 changed files with 28 additions and 0 deletions

2
.gitignore vendored
View file

@ -3,3 +3,5 @@
!PKGBUILD
!.SRCINFO
!update.sh

26
update.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
set -euo pipefail
cd "$(dirname "$0")"
if [ -n "$(git status --porcelain)" ]; then
echo "Working directory not clean"
exit 1
fi
read -r -d "\n" TAG_NAME RELEASE_NAME <<< "$(curl -sSf "https://api.github.com/repos/ruffle-rs/ruffle/releases?per_page=1" | jq -r ".[0] | .tag_name, .name")" || true
sed -e "s/^pkgver=.*/pkgver=${TAG_NAME//-/.}/" \
-e "s/^pkgrel=.*/pkgrel=1/" \
-i PKGBUILD
if [ -z "$(git status --porcelain)" ]; then
echo "Nothing to do"
exit 1
fi
echo "Updating to $RELEASE_NAME..."
updpkgsums
makepkg --printsrcinfo > .SRCINFO
git commit -am "Update to $RELEASE_NAME"