From 6d421cefd191c85f9c7eb9f0f13a12fcc76bec05 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Tue, 15 Aug 2023 10:26:56 +0100 Subject: [PATCH] Squashed '.ci/' changes from cdc32e0..5023473 5023473 Make branch detection work for tagged commits git-subtree-dir: .ci git-subtree-split: 50234738d04b5b26d9e067fed0e58e98931c2e9b --- podman.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/podman.mk b/podman.mk index 1d6213d..4a51640 100644 --- a/podman.mk +++ b/podman.mk @@ -1,7 +1,12 @@ # 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_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) # append branch name to tag if NOT main nor master ifeq (,$(filter main master, $(GIT_BRANCH)))