From 64e7cbacc517e2945bca4b61ff6f8277dd11603a Mon Sep 17 00:00:00 2001 From: Matt Proud Date: Fri, 27 Jan 2023 11:29:59 +0000 Subject: [PATCH] parameterise cliVersion --- cmd/root.go | 3 ++- scripts/build.sh | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 5a9c4a5..a598b4f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,10 +11,11 @@ import ( var username string var password string +var cliVersion string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Version: "0.2.0", + Version: cliVersion, Use: "vcc", Short: "Download binaries from customerconnect.vmware.com", Long: "vcc downloads binaries from customerconnect.vmware.com", diff --git a/scripts/build.sh b/scripts/build.sh index 19d110c..f122499 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -7,8 +7,14 @@ set -eu readonly verison=$1 readonly script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." -env GOOS=linux GOARCH=amd64 go build -o ${script_dir}/builds/vcc-linux-v${verison} +env GOOS=linux GOARCH=amd64 go build \ + -ldflags="-X 'github.com/vmware-labs/vmware-customer-connect-cli/cmd.cliVersion=${verison}'" \ + -o ${script_dir}/builds/vcc-linux-v${verison} -env GOOS=darwin GOARCH=amd64 go build -o ${script_dir}/builds/vcc-darwin-v${verison} +env GOOS=darwin GOARCH=amd64 go build \ + -ldflags="-X github.com/vmware-labs/vmware-customer-connect-cli/cmd.cliVersion=${verison}" \ + -o ${script_dir}/builds/vcc-darwin-v${verison} -env GOOS=windows GOARCH=amd64 go build -o ${script_dir}/builds/vcc-windows-v${verison}.exe +env GOOS=windows GOARCH=amd64 go build \ + -ldflags="-X github.com/vmware-labs/vmware-customer-connect-cli/cmd.cliVersion=${verison}" \ + -o ${script_dir}/builds/vcc-windows-v${verison}.exe