From 9b1783a92a90122816a7b3c35f5760efb33d5fa3 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 27 Dec 2021 23:10:29 +0800 Subject: [PATCH] fix version file generator --- Makefile | 7 +++++-- pkg/version/dev.go | 6 +++--- pkg/version/version.go | 4 ++-- utils/generate-version-file.sh | 10 ++++++++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 765e19e981..23b88c32b0 100644 --- a/Makefile +++ b/Makefile @@ -123,10 +123,13 @@ dist-bbgo-darwin: \ dist: static dist-bbgo-linux dist-bbgo-darwin desktop pkg/version/version.go: .FORCE - bash utils/generate-version-file.sh > $@ + BUILD_FLAGS="release" bash utils/generate-version-file.sh > $@ pkg/version/dev.go: .FORCE - VERSION_SUFFIX="-dev" bash utils/generate-version-file.sh > $@ + BUILD_FLAGS="!release" VERSION_SUFFIX="-dev" bash utils/generate-version-file.sh > $@ + +dev-version: pkg/version/dev.go + git commit $< -m "update dev build version" version: pkg/version/version.go pkg/version/dev.go migrations git commit $< $(word 2,$^) -m "bump version to $(VERSION)" || true diff --git a/pkg/version/dev.go b/pkg/version/dev.go index 20d880a762..006ab2ccf8 100644 --- a/pkg/version/dev.go +++ b/pkg/version/dev.go @@ -1,8 +1,8 @@ -//go:build !release // +build !release package version -const Version = "v1.21.0-b4044156-dev" +const Version = "v1.21.0-4ea4bfb3-dev" + +const VersionGitRef = "4ea4bfb3" -const VersionGitRef = "b4044156" diff --git a/pkg/version/version.go b/pkg/version/version.go index 4ea906648b..234386709d 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -2,7 +2,7 @@ package version -const Version = "v1.21.0-b4044156" +const Version = "v1.21.0-4ea4bfb3" -const VersionGitRef = "b4044156" +const VersionGitRef = "4ea4bfb3" diff --git a/utils/generate-version-file.sh b/utils/generate-version-file.sh index 8278d78e73..f2a1a3ed90 100755 --- a/utils/generate-version-file.sh +++ b/utils/generate-version-file.sh @@ -1,18 +1,24 @@ #!/bin/bash PACKAGE_NAME=version REF=$(git show -s --format=%h -1) -VERSION=$VERSION-$REF if [[ -z $VERSION ]] ; then VERSION=$(git describe --tags) fi +VERSION=$VERSION-$REF + +if [[ -z $BUILD_FLAGS ]] ; then + BUILD_FLAGS=release +fi + + if [[ -n $VERSION_SUFFIX ]] ; then VERSION=${VERSION}${VERSION_SUFFIX} fi cat <