Try to fix the debian version tags

This commit is contained in:
Finn 2021-08-07 12:46:18 -07:00
parent 8567e37af9
commit 0a0bcd5e93
3 changed files with 10 additions and 7 deletions

View file

@ -25,8 +25,8 @@ lint:
- mkdir -p /go/src/gitlab.com/signald/signald-go
- cp -r * /go/src/gitlab.com/signald/signald-go
script:
- (git checkout "${CI_COMMIT_BRANCH}" && git pull)|| true
- VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)"
- (git checkout "${CI_COMMIT_BRANCH}" && git pull) || true
- VERSION="$(./version.sh)"
- echo "building ${VERSION}"
- cd /go/src/gitlab.com/signald/signald-go
- go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=${VERSION} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=${CI_COMMIT_BRANCH} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=${CI_COMMIT_SHA}" ./cmd/signaldctl
@ -43,11 +43,11 @@ lint:
- apt-get update
- apt-get install -y -t buster-backports 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
- (git checkout "${CI_COMMIT_BRANCH}" && git pull)|| true
- (git checkout "${CI_COMMIT_BRANCH}" && git pull) || true
- go run ./cmd/signaldctl doc -o man
- go run ./cmd/signaldctl completion bash > debian/package.bash-completion
- ls *.1 > debian/manpages
- gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(git describe --abbrev=0 HEAD)+git$(date +%Y-%m-%d)r$(git rev-parse --short=8 HEAD).$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)"
- gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(./version.sh)"
- dpkg-buildpackage -us -uc -b
- mv ../*.deb .
needs:
@ -94,7 +94,7 @@ build:cross-compile:
- cp -r * /go/src/gitlab.com/signald/signald-go
script:
- (git checkout "${CI_COMMIT_BRANCH}" && git pull)|| true
- VERSION="$(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)"
- VERSION="$(./version.sh)"
- echo "building ${VERSION}"
- cd /go/src/gitlab.com/signald/signald-go
- go build -o "${CI_PROJECT_DIR}/signaldctl-${GOOS}-${GOARCH}" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=${VERSION} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=${CI_COMMIT_BRANCH} -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=${CI_COMMIT_SHA}" ./cmd/signaldctl
@ -162,4 +162,5 @@ signald.org:
trigger: signald/signald.org
rules:
- if: '$CI_PROJECT_NAMESPACE == "signald" && $CI_COMMIT_REF_PROTECTED == "true"'
when: on_success
when: on_success

View file

@ -1,5 +1,5 @@
signaldctl: signald/client-protocol cmd/signaldctl
go build -ldflags '-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(shell git describe) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=$(shell git rev-parse --abbrev-ref HEAD) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=$(shell git rev-parse HEAD)' -o signaldctl ./cmd/signaldctl
go build -ldflags '-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(./version.sh) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Branch=$(shell git rev-parse --abbrev-ref HEAD) -X gitlab.com/signald/signald-go/cmd/signaldctl/common.Commit=$(shell git rev-parse HEAD)' -o signaldctl ./cmd/signaldctl
protocol.json:
signald --dump-protocol | jq . > protocol.json

2
version.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
echo $(git describe --abbrev=0 HEAD)-$(git rev-list $(git describe --abbrev=0 HEAD)..HEAD --count)-$(git rev-parse --short=8 HEAD)