From ea29c29531b40a5488909158b587a6636779aee9 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Tue, 9 Jul 2024 23:33:44 +0100 Subject: [PATCH] created new build script for powershell --- build.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 build.ps1 diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..41912bc --- /dev/null +++ b/build.ps1 @@ -0,0 +1,18 @@ + +$current_directory = "$(pwd.exe)" +Set-Variable -Name GOPATH -Value "$HOME/go:$current_directory" + +# NOTE: The following commands assumes you have Git For Windows +# installed, which comes with a bunch of GNU tools packaged for windows: +Set-Variable -Name GIT_COMMIT -Value "$(git rev-list -1 HEAD)" +Set-Variable -Name CANONICAL_VERSION -Value "$(cat.exe ./VERSION)-$(uname)" +Set-Variable -Name VERSION_STRING -Value "$CANONICAL_VERSION-$GIT_COMMIT" + +Set-Variable -Name buildpath -Value "build/$(uname)/gostations.exe" + +go mod vendor +go mod tidy + +go build -o "$buildpath" -ldflags "-X main.version=$VERSION_STRING" + +& $buildpath -v