flokati/genversion.sh

17 lines
474 B
Bash
Executable File

#!/bin/sh
VERSIONDIR="version"
VERSIONGO="version/version.go"
if [ ! -d "$VERSIONDIR" ]; then
mkdir $VERSIONDIR
fi
echo "package version" >$VERSIONGO
echo "" >>$VERSIONGO
echo "const (" >>$VERSIONGO
echo -n " FlokatiVersion = \"" >>$VERSIONGO
echo -n `git rev-parse --abbrev-ref HEAD` >>$VERSIONGO
echo "\"" >>$VERSIONGO
echo -n " FlokatiBuild = \"" >>$VERSIONGO
echo -n `git rev-list HEAD --count` >>$VERSIONGO
echo "\"" >>$VERSIONGO
echo ")" >>$VERSIONGO