From 3768e96926ae52ed9f8df6fa1844ad77d3404681 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 20 Sep 2020 23:33:03 +0200 Subject: [PATCH] fix versioning --- .drone.jsonnet | 5 +++-- .drone.yml | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 4c69112..12afe56 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -85,7 +85,7 @@ local PipelineBuildBinaries = { commands: [ '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}', 'mkdir -p release/', - "cd cmd/drone-github-comment && xgo -ldflags \"-s -w -X main.Version=$$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out drone-github-comment .", + "cd cmd/drone-github-comment && xgo -ldflags \"-s -w -X main.version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out drone-github-comment .", 'mv /build/* /drone/src/release/', ], }, @@ -151,7 +151,8 @@ local PipelineBuildContainer(arch='amd64') = { name: 'build', image: 'golang:1.14', commands: [ - 'go build -v -ldflags "-X main.version=${DRONE_TAG:-latest}" -a -tags netgo -o release/' + arch + '/drone-github-comment ./cmd/drone-github-comment', + '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}', + 'go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/' + arch + '/drone-github-comment ./cmd/drone-github-comment', ], }, { diff --git a/.drone.yml b/.drone.yml index dac4bd0..e78ac3f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -63,7 +63,7 @@ steps: commands: - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - mkdir -p release/ - - cd cmd/drone-github-comment && xgo -ldflags "-s -w -X main.Version=$$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out drone-github-comment . + - cd cmd/drone-github-comment && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out drone-github-comment . - mv /build/* /drone/src/release/ - name: executable @@ -118,7 +118,8 @@ steps: - name: build image: golang:1.14 commands: - - go build -v -ldflags "-X main.version=${DRONE_TAG:-latest}" -a -tags netgo -o release/amd64/drone-github-comment ./cmd/drone-github-comment + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" + - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/amd64/drone-github-comment ./cmd/drone-github-comment - name: dryrun image: plugins/docker:18-linux-amd64 @@ -194,7 +195,8 @@ steps: - name: build image: golang:1.14 commands: - - go build -v -ldflags "-X main.version=${DRONE_TAG:-latest}" -a -tags netgo -o release/arm64/drone-github-comment ./cmd/drone-github-comment + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" + - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm64/drone-github-comment ./cmd/drone-github-comment - name: dryrun image: plugins/docker:18-linux-arm64 @@ -270,7 +272,8 @@ steps: - name: build image: golang:1.14 commands: - - go build -v -ldflags "-X main.version=${DRONE_TAG:-latest}" -a -tags netgo -o release/arm/drone-github-comment ./cmd/drone-github-comment + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" + - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm/drone-github-comment ./cmd/drone-github-comment - name: dryrun image: plugins/docker:18-linux-arm @@ -429,6 +432,6 @@ depends_on: --- kind: signature -hmac: 95c46cb9e02b2d4ac12e9048a2fbcfd24ec13a69675dbcd8dfce12791de6c9db +hmac: 82c6056ce45400d94af46bef439d8f22ffd8b2465a95818d433487311aa0d277 ...