more version detection

This commit is contained in:
Finn 2021-02-03 02:30:14 -08:00
parent 2760d33cae
commit 8b7269ae09
2 changed files with 2 additions and 3 deletions

View file

@ -24,7 +24,6 @@ lint:
- cp -r * /go/src/gitlab.com/signald/signald-go - cp -r * /go/src/gitlab.com/signald/signald-go
script: script:
- git checkout "${CI_COMMIT_BRANCH}" - git checkout "${CI_COMMIT_BRANCH}"
- git pull --tags
- VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)" - VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)"
- echo "building ${VERSION}" - echo "building ${VERSION}"
- cd /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go
@ -49,7 +48,6 @@ build:cross-compile:
- cp -r * /go/src/gitlab.com/signald/signald-go - cp -r * /go/src/gitlab.com/signald/signald-go
script: script:
- git checkout "${CI_COMMIT_BRANCH}" - git checkout "${CI_COMMIT_BRANCH}"
- git pull --tags
- VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)" - VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)"
- echo "building ${VERSION}" - echo "building ${VERSION}"
- cd /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go
@ -76,6 +74,7 @@ build:x86:deb:
- apt-get install -y git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev - apt-get install -y git-buildpackage dh-golang bash-completion golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev
- apt-get install -y ./*.deb && rm -vf *.deb - apt-get install -y ./*.deb && rm -vf *.deb
script: script:
- git checkout "${CI_COMMIT_BRANCH}"
- go run ./cmd/signaldctl doc -o man - go run ./cmd/signaldctl doc -o man
- go run ./cmd/signaldctl completion bash > debian/package.bash-completion - go run ./cmd/signaldctl completion bash > debian/package.bash-completion
- ls *.1 > debian/manpages - ls *.1 > debian/manpages

2
debian/rules vendored
View file

@ -3,7 +3,7 @@
export DH_GOLANG_EXCLUDES := tools/ export DH_GOLANG_EXCLUDES := tools/
PKG := gitlab.com/signald/signald-go PKG := gitlab.com/signald/signald-go
# GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Version=$(DEB_VERSION) 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 git rev-parse HEAD)
GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Commit=$(CI_BUILD_REF) GO_LDFLAGS += -X $(PKG)/cmd/signaldctl/common.Commit=$(CI_BUILD_REF)