chore: semver-compliant version for dev and nightly builds (#32663)
This commit is contained in:
parent
c1fac30171
commit
09c2ce3055
14 changed files with 103 additions and 64 deletions
9
Makefile
9
Makefile
|
|
@ -1,6 +1,13 @@
|
|||
# build vars
|
||||
TAG_NAME ?= $(shell test -d .git && git describe --abbrev=0 --tags)
|
||||
# part of the latest tag incremented for untagged builds: minor or patch
|
||||
BUMP ?= minor
|
||||
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=.)
|
||||
# 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)
|
||||
# hide commit for releases
|
||||
ifeq ($(RELEASE),1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue