From 0716f4565a7eb9f91a3540079f6ae9c336c05e4e Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Mon, 13 Jul 2020 20:25:09 +0200 Subject: [PATCH] Improve versioning and building --- build.sh | 10 +--------- cmd/FLEcli_version.go | 4 ++-- full_build.sh | 4 +++- update-version.sh | 13 +++++++++++++ 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100755 update-version.sh diff --git a/build.sh b/build.sh index 5c263a0..3e78776 100755 --- a/build.sh +++ b/build.sh @@ -2,15 +2,7 @@ set -e -VERSION_FROM_GIT=$(git describe --tags) -BUILD_TIME=$(date +%F) -echo "$VERSION_FROM_GIT" -echo "$BUILD_TIME" - -echo "package cmd" > cmd/FLEcli_version.go -echo " " >> cmd/FLEcli_version.go -echo "//VersionString is the version that will be displayed with the -v switch" >> cmd/FLEcli_version.go -echo "const VersionString = \"${VERSION_FROM_GIT} (${BUILD_TIME})\"" >> cmd/FLEcli_version.go +./update-version.sh go build go test ./... \ No newline at end of file diff --git a/cmd/FLEcli_version.go b/cmd/FLEcli_version.go index 29e9438..752ff51 100644 --- a/cmd/FLEcli_version.go +++ b/cmd/FLEcli_version.go @@ -1,4 +1,4 @@ package cmd - + //VersionString is the version that will be displayed with the -v switch -const VersionString = "v0.0.0.0-1-gb264805 (2020-07-13)" +const VersionString = "v0.0.0.0-3-gefb75a4 (2020-07-13)" diff --git a/full_build.sh b/full_build.sh index 4c1f654..1de613f 100755 --- a/full_build.sh +++ b/full_build.sh @@ -2,13 +2,15 @@ set -e +echo "Testing..." + go test ./... mkdir -p executables/windows mkdir -p executables/macos mkdir -p executables/linux -#Update version +./update-version.sh GOOS=windows GOARCH=386 go build -o executables/windows/FLEcli.exe GOOS=darwin GOARCH=amd64 go build -o executables/macos/FLEcli diff --git a/update-version.sh b/update-version.sh new file mode 100755 index 0000000..6b57731 --- /dev/null +++ b/update-version.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +VERSION_FROM_GIT=$(git describe --tags) +BUILD_TIME=$(date +%F) + +echo "Building version ${VERSION_FROM_GIT}" + +echo "package cmd" > cmd/FLEcli_version.go +echo " " >> cmd/FLEcli_version.go +echo "//VersionString is the version that will be displayed with the -v switch" >> cmd/FLEcli_version.go +echo "const VersionString = \"${VERSION_FROM_GIT} (${BUILD_TIME})\"" >> cmd/FLEcli_version.go