chore: semver-compliant version for dev and nightly builds (#32663)

This commit is contained in:
andig 2026-08-09 15:00:31 +02:00 • committed by GitHub
parent c1fac30171
commit 09c2ce3055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 103 additions and 64 deletions

View file

@ -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)