Make branch detection work for tagged commits
This commit is contained in:
parent
cdc32e01ea
commit
50234738d0
@ -1,7 +1,12 @@
|
|||||||
# Parse version from latest git semver tag
|
# Parse version from latest git semver tag
|
||||||
GIT_BRANCH ?= $(shell git name-rev --name-only HEAD 2>/dev/null | sed -e 's,remotes/origin/,,' -e 's/[^a-zA-Z0-9]/-/g')
|
|
||||||
GIT_TAG := $(shell git describe --tags --match v*.*.* 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
|
GIT_TAG := $(shell git describe --tags --match v*.*.* 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
|
||||||
|
|
||||||
|
GIT_BRANCH ?= $(shell git name-rev --name-only HEAD 2>/dev/null | sed -e 's,remotes/origin/,,' -e 's/[^a-zA-Z0-9]/-/g')
|
||||||
|
# if "tags/" is in the branchname we are actually on a tag and need to use rev-parse instead
|
||||||
|
ifeq ($(findstring tags/, $(GIT_TAG)),)
|
||||||
|
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||||
|
endif
|
||||||
|
|
||||||
TAG := $(GIT_TAG)
|
TAG := $(GIT_TAG)
|
||||||
# append branch name to tag if NOT main nor master
|
# append branch name to tag if NOT main nor master
|
||||||
ifeq (,$(filter main master, $(GIT_BRANCH)))
|
ifeq (,$(filter main master, $(GIT_BRANCH)))
|
||||||
|
Loading…
Reference in New Issue
Block a user