Fix versions

This commit is contained in:
Finn 2021-02-03 00:10:45 -08:00
parent 80847206e6
commit 254de4d863
2 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -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: