summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 0c62cf7dbcb..56e76c377a2 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