From 254de4d8636b010eda66e1d6e6d943fef8e0e6b2 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 3 Feb 2021 00:10:45 -0800 Subject: [PATCH] Fix versions --- .gitlab-ci.yml | 40 ++++++++++++++++++++-------------------- cmd/signaldctl/README.md | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fae72ef..42d036e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,29 +16,44 @@ lint: - diff --color=always go.mod "${CI_PROJECT_DIR}/go.mod" - diff --color=always go.sum "${CI_PROJECT_DIR}/go.sum" -build:x86: +.build: stage: build image: golang:latest before_script: - mkdir -p /go/src/gitlab.com/signald/signald-go - 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" --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 + - 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)" + - 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 artifacts: paths: - signaldctl expire_in: 1 month +build:x86: + extends: .build + +build:aarch64: + tags: [arm-builder] + extends: .build + build:cross-compile: stage: build image: golang:latest before_script: - mkdir -p /go/src/gitlab.com/signald/signald-go - 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-${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 + - 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)" + - 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 artifacts: paths: - signaldctl-* @@ -53,21 +68,6 @@ build:cross-compile: - GOOS: darwin GOARCH: amd64 -build:aarch64: - stage: build - tags: [arm-builder] - image: golang:latest - before_script: - - mkdir -p /go/src/gitlab.com/signald/signald-go - - 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" --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 - expire_in: 1 month - build:x86:deb: stage: build image: debian:latest diff --git a/cmd/signaldctl/README.md b/cmd/signaldctl/README.md index ec0ea6d..5e3cf0a 100644 --- a/cmd/signaldctl/README.md +++ b/cmd/signaldctl/README.md @@ -13,7 +13,7 @@ otherwise, download a binary from the CI: * [Linux amd64](https://gitlab.com/api/v4/projects/21018340/jobs/artifacts/main/raw/signaldctl?job=build%3Ax86) * [Linux arm](https://gitlab.com/api/v4/projects/21018340/jobs/artifacts/main/raw/signaldctl-linux-arm?job=build%3Across-compile) * [Linux arm64](https://gitlab.com/api/v4/projects/21018340/jobs/artifacts/main/raw/signaldctl?job=build%3Aaarch64) -* [Mac amd64](https://gitlab.com/api/v4/projects/21018340/jobs/artifacts/main/raw/signaldctl-darwin-amd64?job=build%3Across-compile) +* [Mac amd64](https://gitlab.com/api/v4/projects/21018340/jobs/artifacts/main/raw/signaldctl-darwin-amd64?job=build%3Across-compile%3A%20%5Bdarwin%2C%20amd64%5D) or build it yourself: