use GIT_TAG to override Version

This commit is contained in:
Mikaël Cluseau 2024-01-07 11:09:20 +01:00
parent b5b7272603
commit f59eca6724
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,8 @@ run \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \ --mount=type=cache,id=gobuild,target=/root/.cache/go-build \
go mod download go mod download
arg GIT_TAG
copy . ./ copy . ./
run \ run \
--mount=type=cache,id=gomod,target=/go/pkg/mod \ --mount=type=cache,id=gomod,target=/go/pkg/mod \

View File

@ -1,3 +1,3 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
go build -o dist/ -trimpath -ldflags "-X main.Version=$(git describe --always --dirty)" $* go build -o dist/ -trimpath -ldflags "-X main.Version=${GIT_TAG:-$(git describe --always --dirty)}" $*