From 0a0bcd5e93d1a4c72c4325888cc27854f38f5df7 Mon Sep 17 00:00:00 2001 From: Finn Date: Sat, 7 Aug 2021 12:46:18 -0700 Subject: [PATCH] Try to fix the debian version tags --- .gitlab-ci.yml | 13 +++++++------ Makefile | 2 +- version.sh | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100755 version.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 493a1c5..cd1ab35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file + when: on_success + \ No newline at end of file diff --git a/Makefile b/Makefile index 84f33d5..824a46c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/version.sh b/version.sh new file mode 100755 index 0000000..ff69408 --- /dev/null +++ b/version.sh @@ -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) \ No newline at end of file