diff --git a/Makefile b/Makefile index b4dc196d7..ff5bf1092 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SHA ?= $(shell test -d .git && git rev-parse --short HEAD) GIT_TAG := $(shell test -d .git && git describe --abbrev=0 --tags) # commits since the latest tag, empty or 0 means the commit is tagged GIT_DIST := $(shell test -n "$(GIT_TAG)" && git rev-list --count $(GIT_TAG)..HEAD) -NEXT_TAG = $(shell echo $(GIT_TAG) | awk -F. -v b='$(BUMP)' '{if (b == "patch") $$NF++; else {$$2++; $$3=0}} 1' OFS=.) +NEXT_TAG = $(shell echo $(GIT_TAG) | awk -F. -v b='$(BUMP)' '{ if (b == "patch") { m = $$2; p = $$3 + 1 } else { m = $$2 + 1; p = 0 }; print $$1 "." m "." p }') # untagged builds are semver pre-releases of the upcoming version TAG_NAME ?= $(if $(filter-out 0,$(GIT_DIST)),$(NEXT_TAG)-dev+$(SHA),$(GIT_TAG)) COMMIT := $(SHA)