summarylogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Barri2021-03-21 08:54:41 +1100
committerDavid Barri2021-03-21 08:54:41 +1100
commitd101892f349ef392c7ed1e06ef597b8b6e5067f1 (patch)
tree33300b98d73b1e4bd9b746277535ca804eb1cc5a /Makefile
parentfe358cba8d4c9f95bcb5b1f5264bf119957b6d43 (diff)
downloadaur-d101892f349ef392c7ed1e06ef597b8b6e5067f1.tar.gz
Add auto-update
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 0c62cf7dbcb2..56e76c377a28 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,17 @@
-.PHONY: post clean upgrade versions
+.PHONY: post clean upgrade versions auto-update
-LATEST_VER := $(shell curl -s https://github.com/CryptoGraphics/VerthashMiner/releases/latest | perl -pe 's!.*/tag/(.+?)".*!$$1!')
+CURRENT_VER := $(shell grep '^pkgver' PKGBUILD | sed 's/.*=//')
+LATEST_VER := $(shell curl -s https://github.com/CryptoGraphics/VerthashMiner/releases/latest | perl -pe 's!.*/tag/v?([0-9].+?)".*!$$1!')
versions:
@echo "Current version:"
- @grep '^pkgver' PKGBUILD | sed 's/.*=/ /'
+ @echo " $(CURRENT_VER)"
@echo "Latest version:"
@echo " $(LATEST_VER)"
upgrade:
perl -pi -e 's/^pkgver=.+/pkgver=$(LATEST_VER)/' PKGBUILD
- bash -c 'perl -pi -e "s/^sha256sums=.+/$$(makepkg -g)/" PKGBUILD'
+ bash -c 'perl -pi -e "s/^sha256sums=[^)]+\)/$$(makepkg -g)/" PKGBUILD'
make post
git add .SRCINFO PKGBUILD
git commit -m "Upgrade to $(LATEST_VER)" .SRCINFO PKGBUILD
@@ -22,3 +23,10 @@ post:
clean:
git clean -fX
+
+auto-update:
+ifeq ($(CURRENT_VER),$(LATEST_VER))
+ @echo "No update available. Version: $(CURRENT_VER)"
+else
+ @make upgrade && git push
+endif