1
0
mirror of https://github.com/pcvolkmer/cert-tools.git synced 2025-04-19 17:06:49 +00:00

chore: use semver like version string

This commit is contained in:
Paul-Christian Volkmer 2025-01-25 01:39:04 +01:00
parent bcdec259f7
commit a777289dcc

View File

@ -2,18 +2,26 @@ ifndef VERBOSE
.SILENT: .SILENT:
endif endif
TAG = `git describe --tag 2>/dev/null` GITTAG = $(shell git describe --tag --abbrev=0 2>/dev/null | sed -En 's/v(.*)$$/\1/p')
ifeq ($(findstring -, $(GITTAG)), -)
GITDEV = $(shell git describe --tag 2>/dev/null | sed -En 's/v(.*)-([0-9]+)-g([0-9a-f]+)$$/.dev.\2+\3/p')
else
GITDEV = $(shell git describe --tag 2>/dev/null | sed -En 's/v(.*)-([0-9]+)-g([0-9a-f]+)$$/-dev.\2+\3/p')
endif
VERSION := "$(GITTAG)$(GITDEV)"
REV = git`git rev-parse HEAD | cut -c1-7` NAME := cert-tools
NAME = cert-tools
package-all: win-installer win-package linux-package package-all: win-installer win-package linux-package
.PHONY: version
version:
echo $(VERSION)
.PHONY: win-installer .PHONY: win-installer
win-installer: win-binary-x86_64 win-installer: win-binary-x86_64
makensis installer.nsi makensis installer.nsi
mv target/$(NAME)-installer.exe target/$(NAME)-installer-$(TAG).exe || ren target/$(NAME)-installer.exe target/$(NAME)-installer-$(TAG).exe mv target/$(NAME)-installer.exe target/$(NAME)-installer-$(VERSION).exe || ren target/$(NAME)-installer.exe target/$(NAME)-installer-$(VERSION).exe
.PHONY: win-package .PHONY: win-package
win-package: win-binary-x86_64 win-package: win-binary-x86_64
@ -22,7 +30,7 @@ win-package: win-binary-x86_64
cp target/x86_64-pc-windows-gnu/release/cert-tools-ui.exe $(NAME)/ cp target/x86_64-pc-windows-gnu/release/cert-tools-ui.exe $(NAME)/
cp LICENSE $(NAME)/ cp LICENSE $(NAME)/
# first try (linux) zip command, then powershell sub command to create ZIP file # first try (linux) zip command, then powershell sub command to create ZIP file
zip target/$(NAME)-$(TAG)_win64.zip $(NAME)/* || powershell Compress-ARCHIVE $(NAME) target\$(NAME)-$(TAG)_win64.zip zip target/$(NAME)-$(VERSION)_win64.zip $(NAME)/* || powershell Compress-ARCHIVE $(NAME) target\$(NAME)-$(VERSION)_win64.zip
rm -rf $(NAME) || true rm -rf $(NAME) || true
.PHONY: linux-package .PHONY: linux-package
@ -31,7 +39,7 @@ linux-package: linux-binary-x86_64
cp target/x86_64-unknown-linux-gnu/release/cert-tools $(NAME)/ cp target/x86_64-unknown-linux-gnu/release/cert-tools $(NAME)/
cp target/x86_64-unknown-linux-gnu/release/cert-tools-ui $(NAME)/ cp target/x86_64-unknown-linux-gnu/release/cert-tools-ui $(NAME)/
cp LICENSE $(NAME)/ cp LICENSE $(NAME)/
tar -czvf target/$(NAME)-$(TAG)_linux.tar.gz $(NAME)/ tar -czvf target/$(NAME)-$(VERSION)_linux.tar.gz $(NAME)/
rm -rf $(NAME) || true rm -rf $(NAME) || true
binary-all: win-binary-x86_64 linux-binary-x86_64 binary-all: win-binary-x86_64 linux-binary-x86_64