Fix how branch is determined in CI

This commit is contained in:
Finn 2021-02-27 12:29:07 -08:00
parent 80a6cc017a
commit b2e3eae82d
2 changed files with 9 additions and 1 deletions

8
debian/get-branch.sh vendored Executable file
View file

@ -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

2
debian/rules vendored
View file

@ -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: