properly set GIT_BRANCH when building on gitlab-ci

https://docs.gitlab.com/ce/ci/variables/README.html
CI_COMMIT_REF_NAME

Signed-off-by: Thomas Bernard <miniupnp@free.fr>
This commit is contained in:
Thomas Bernard 2018-05-14 00:00:48 +02:00
parent af22ed7333
commit 994b950616

View File

@ -35,7 +35,11 @@
# Detect GIT revision
GIT_REVISION = $(shell git rev-list --count 1af8c74f53110e349d8f0d19b14599281913f71f..)
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
ifneq (,$(CI_COMMIT_REF_NAME))
GIT_BRANCH = $(CI_COMMIT_REF_NAME)
else
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
endif
ifneq (master,$(GIT_BRANCH))
GIT_REVISION := "$(GIT_REVISION)-$(GIT_BRANCH)"
endif