From b2e3eae82dfc1e7423c0fbe7a97f369a8f6428cc Mon Sep 17 00:00:00 2001 From: Finn Date: Sat, 27 Feb 2021 12:29:07 -0800 Subject: [PATCH] Fix how branch is determined in CI --- debian/get-branch.sh | 8 ++++++++ debian/rules | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 debian/get-branch.sh diff --git a/debian/get-branch.sh b/debian/get-branch.sh new file mode 100755 index 0000000..0fbcc1e --- /dev/null +++ b/debian/get-branch.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +if [ -z ${CI_COMMIT_REF_NAME+x} ]; then + # CI_COMMIT_REF_NAME is unset, try to derive it from git + git rev-parse --abbrev-ref HEAD +else + echo "${CI_COMMIT_REF_NAME}" +fi + \ No newline at end of file diff --git a/debian/rules b/debian/rules index 6a9db60..5295052 100755 --- a/debian/rules +++ b/debian/rules @@ -4,7 +4,7 @@ export DH_GOLANG_EXCLUDES := tools/ PKG := gitlab.com/signald/signald-go GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Version=$(DEB_VERSION) -GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Branch=$(shell git rev-parse HEAD) +GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Branch=$(shell debian/get-branch.sh) GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Commit=$(CI_BUILD_REF) override_dh_auto_install: