From 1531a6e8e975822d34caec77242769c2fcba1075 Mon Sep 17 00:00:00 2001 From: Andrew Dunstall Date: Sun, 9 Jun 2024 13:46:11 +0100 Subject: [PATCH] build: add version to build script --- build/artifacts.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/artifacts.sh b/build/artifacts.sh index dbdccfb..217972a 100755 --- a/build/artifacts.sh +++ b/build/artifacts.sh @@ -11,11 +11,12 @@ mkdir -p bin/artifacts for i in "${arr[@]}" do + VERSION=$(git describe) GOOSARCH=$i GOOS=${GOOSARCH%/*} GOARCH=${GOOSARCH#*/} BINARY_NAME=piko-$GOOS-$GOARCH - echo "Building $BINARY_NAME..." - GOOS=$GOOS GOARCH=$GOARCH go build -o bin/artifacts/$BINARY_NAME main.go + echo "Building $BINARY_NAME $VERSION..." + GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-X github.com/andydunstall/piko/pkg/build.Version=$VERSION" -o bin/artifacts/$BINARY_NAME main.go done