bbgo_origin/utils/generate-version-file.sh

30 lines
435 B
Bash
Raw Normal View History

2021-02-22 07:16:12 +00:00
#!/bin/bash
PACKAGE_NAME=version
2021-12-07 05:56:51 +00:00
REF=$(git show -s --format=%h -1)
if [[ -z $VERSION ]] ; then
VERSION=$(git describe --tags)
fi
2021-02-22 07:16:12 +00:00
2021-12-27 15:10:29 +00:00
VERSION=$VERSION-$REF
if [[ -z $BUILD_FLAGS ]] ; then
BUILD_FLAGS=release
fi
2021-12-08 15:40:58 +00:00
if [[ -n $VERSION_SUFFIX ]] ; then
VERSION=${VERSION}${VERSION_SUFFIX}
fi
2021-02-22 07:16:12 +00:00
cat <<END
2022-08-24 05:03:00 +00:00
//go:build !release
// +build !release
2021-02-22 07:16:12 +00:00
package $PACKAGE_NAME
2021-02-22 07:16:12 +00:00
const Version = "${VERSION}"
2021-02-22 07:16:12 +00:00
2021-12-07 05:56:51 +00:00
const VersionGitRef = "${REF}"
2021-02-22 07:16:12 +00:00
END