From 0d5382a71d7f43b6074d5a2015ac385a848699b9 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Sat, 11 May 2024 19:06:21 +0200 Subject: [PATCH] Makefile --- makefile | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 19c9fc7..8cca887 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,8 @@ +GITHASH := $(shell git rev-parse --short HEAD)$(shell git diff-index --quiet HEAD || echo "-dirty") + +TARNAME := hatelace-imbus_$(GITHASH).tar.gz +DIRNAME := hatelace + run: ./gradlew run @@ -6,11 +11,35 @@ watch: build: ./gradlew build + ls -lh app/build/libs/*.jar clean: ./gradlew clean + rm -f *.tar.gz *.tar.gz.minisig *.zip *.jpg test: ./gradlew test -.PHONY: run build clean +$(TARNAME): + git archive --format=tar --prefix=$(DIRNAME)/ HEAD > intermediate.tar + tar -f intermediate.tar --delete $(DIRNAME)/doc + gzip -9 -c intermediate.tar > $(TARNAME) + rm intermediate.tar + +$(TARNAME).minisig: $(TARNAME) + minisign -Sm $(TARNAME) + +tar: $(TARNAME) + tar -tvf $(TARNAME) + +sign: $(TARNAME).minisig + +publish: $(TARNAME) $(TARNAME).minisig + @git diff-index --quiet HEAD || (echo "git is dirty, commit changes first"; exit 1) + ssh server mkdir -p /public/$(DIRNAME) + rsync -avz $(TARNAME).minisig server:/public/$(DIRNAME)/$(TARNAME).minisig + rsync -avz $(TARNAME) server:/public/$(DIRNAME)/$(TARNAME) + ssh server ln -sf /public/$(DIRNAME)/$(TARNAME).minisig /public/$(DIRNAME)/latest.tar.gz.minisig + ssh server ln -sf /public/$(DIRNAME)/$(TARNAME) /public/$(DIRNAME)/latest.tar.gz + +.PHONY: run watch build clean test archive sign publish