Browse Source

update build script

Xuu 7 months ago
parent
commit
8731506a00
1 changed files with 19 additions and 12 deletions
  1. 19 12
      Makefile

+ 19 - 12
Makefile

@@ -1,8 +1,10 @@
 include config.inc
 
 NAME=sour.is-skillet
-VERSION := $(shell cat VERSION)
-DATE := $(shell date -u +%FT%TZ)
+VERSION=$(shell debian/inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`)|cut -b2-)
+VERSION_MIN=$(shell debian/inc_version.sh -m $(VERSION))
+VERSION_MAJ=$(shell debian/inc_version.sh -M $(VERSION))
+DATE:=$(shell date -u +%FT%TZ)
 
 run: bin/skillet
 	cd shell && ../bin/skillet -vv connect -u /tmp/skillet.sock
@@ -23,8 +25,20 @@ bin/skillet-lnx64:
     		 -ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
     		 sour.is/x/skillet/cmd/skillet
 
+tag-patch:
+	git tag -a -m "release version $(VERSION)" "v$(VERSION)"
+	git push --tags
+
+tag-minor:
+	git tag -a -m "release version $(VERSION_MIN)" "v$(VERSION_MIN)"
+	git push --tags
+
+tag-major:
+	git tag -a -m "release version $(VERSION_MAJ)" "v$(VERSION_MAJ)"
+	git push --tags
+
 # Creates a deb file
-pkg: clean bin/skillet-lnx64 inc-patch
+pkg: clean bin/skillet-lnx64
 	export BUILD="debian/BUILD/$(NAME)_$(VERSION)"; \
 	rm -rf "debian/BUILD"; \
 	mkdir -p debian/BUILD; \
@@ -34,21 +48,14 @@ pkg: clean bin/skillet-lnx64 inc-patch
 	cp bin/skillet-lnx64 $$BUILD/opt/sour.is/bin/skillet; \
 	dpkg-deb -b -Zgzip $${BUILD}
 
-inc-patch:
-	debian/inc_version.sh -p $(VERSION) > VERSION
-inc-minor:
-	debian/inc_version.sh -m $(VERSION) > VERSION
-inc-major:
-	debian/inc_version.sh -M $(VERSION) > VERSION
-
 REPO_HOST="kapha"
 REPO_PATH="/opt/web/pub/sour.is/debian/"
 ANSIBLE_HOST="skillet"
 
-copy: pkg
+copy:
 	export BUILD="debian/BUILD/$(NAME)_$(VERSION)"; \
 	scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \
 	ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION).deb";
 
-deploy: copy
+deploy:
 	ansible $(ANSIBLE_HOST) -b -m apt -a "name=$(NAME) update_cache=yes state=latest"