summarylogtreecommitdiffstats
path: root/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/update.sh b/update.sh
new file mode 100755
index 00000000000..97c5ffce1f7
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+echo "Fetching latest release..."
+LATEST=$(hub api repos/Rigellute/spotify-tui/releases/latest | jq '.tag_name' -r)
+
+CURRENT=$(grep '^pkgver=' PKGBUILD | grep -oEi '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+')
+if [ "$CURRENT" = "$LATEST" ]; then
+ echo "Package is up-to-date."
+else
+ echo "Updating from $CURRENT to $LATEST"
+ sed -i 's/^pkgver=.*/pkgver='$LATEST'/' PKGBUILD
+ sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD
+
+ updpkgsums
+ makepkg --printsrcinfo > .SRCINFO
+
+ git add PKGBUILD .SRCINFO
+ git commit -m "Update to $LATEST"
+fi