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: