From 80847206e6d5b83da23fe0e3707fdbf64f96399b Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 2 Feb 2021 21:54:42 -0800 Subject: [PATCH] fix version numbers in CI builds --- .gitlab-ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d9f122e..fae72ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ build:x86: - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - - go build -o "${CI_PROJECT_DIR}/signaldctl" ./cmd/signaldctl + - go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -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 artifacts: paths: - signaldctl @@ -38,8 +38,7 @@ build:cross-compile: - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - - make signaldctl - - mv signaldctl "${CI_PROJECT_DIR}/signaldctl-${GOOS}-${GOARCH}" + - go build -o "${CI_PROJECT_DIR}/signaldctl-${GOOS}-${GOARCH}" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -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 artifacts: paths: - signaldctl-* @@ -63,7 +62,7 @@ build:aarch64: - cp -r * /go/src/gitlab.com/signald/signald-go - cd /go/src/gitlab.com/signald/signald-go script: - - go build -o "${CI_PROJECT_DIR}/signaldctl" ./cmd/signaldctl + - go build -o "${CI_PROJECT_DIR}/signaldctl" --ldflags "-X gitlab.com/signald/signald-go/cmd/signaldctl/common.Version=$(git -C ${CI_PROJECT_DIR} describe) -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 artifacts: paths: - signaldctl