goselfupdatetest/injectGitVars.sh
Lukas Bachschwell 25d795ae04
Update and git tag version
Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
2021-01-09 16:28:08 +01:00

16 lines
464 B
Bash

BUILD_TIME=`date +%FT%T%z`
GIT_REVISION=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
GIT_TAG=`git describe --abbrev=0 --tags`
GITINFO="package main
var buildTime string = \"${BUILD_TIME}\"
var gitRevision string = \"${GIT_DIRTY}${GIT_REVISION}\"
var gitBranch string = \"${GIT_BRANCH}\"
var gitTag string = \"${GIT_TAG}\""
echo "$GITINFO" > gitinfo.go