bbgo_origin/utils/generate-version-file.sh

24 lines
354 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)
VERSION=$VERSION-$REF
if [[ -z $VERSION ]] ; then
VERSION=$(git describe --tags)
fi
2021-02-22 07:16:12 +00:00
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
// +build release
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