From 3ae9f2afa2f8dc8ef998a565c25199a2099dba2b Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sun, 21 Jul 2024 17:29:16 +0100 Subject: [PATCH] custom build script for gitea runner --- .gitea/workflows/build.yml | 2 +- ci-build.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 ci-build.sh diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 9f6ff8b..65cd588 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -23,4 +23,4 @@ jobs: && go version - name: Linux Build run: - ./build.sh + ./ci-build.sh diff --git a/ci-build.sh b/ci-build.sh new file mode 100755 index 0000000..b3c39ee --- /dev/null +++ b/ci-build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +GO = $(which go) + +mkdir build + +GIT_COMMIT=$(git rev-list -1 HEAD) +export GIT_COMMIT +CANONICAL_VERSION=$(cat ./VERSION)-$(uname) +export CANONICAL_VERSION +VERSION_STRING="$CANONICAL_VERSION-$GIT_COMMIT" +export VERSION_STRING + +buildpath="build/$(uname)/gostations" + +${GO} mod vendor +${GO} mod tidy + +${GO} build -o "$buildpath" -ldflags "-X main.version=$VERSION_STRING" + +"$buildpath" -v +