bbgo_origin/utils/generate-version-file.sh

30 lines
443 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-09-05 10:18:45 +00:00
//go:build $BUILD_FLAGS
// +build $BUILD_FLAGS
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