diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-10-01 16:09:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 16:09:11 +0100 |
commit | 7048532bc4adcc017739fae358fd6b6c44b63ebd (patch) | |
tree | 90c508a0302cb6885990513d0d49637de0041001 /build.sh | |
parent | dbae85283f3927444aa89221523405ada07a0f4a (diff) |
Update version imprinting (#1462)
* Add version tag constant
* Update build imprinting
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -3,10 +3,16 @@ # Put installed packages into ./bin export GOBIN=$PWD/`dirname $0`/bin -export BRANCH=`(git symbolic-ref --short HEAD | cut -d'/' -f 3 )|| ""` -export BUILD=`git rev-parse --short HEAD || ""` +if [ -d ".git" ] +then + export BUILD=`git rev-parse --short HEAD || ""` + export BRANCH=`(git symbolic-ref --short HEAD | tr -d \/ ) || ""` + [[ $BRANCH == "master" ]] && export BRANCH="" -export FLAGS="-X github.com/matrix-org/dendrite/internal.branch=$BRANCH -X github.com/matrix-org/dendrite/internal.build=$BUILD" + export FLAGS="-X github.com/matrix-org/dendrite/internal.branch=$BRANCH -X github.com/matrix-org/dendrite/internal.build=$BUILD" +else + export FLAGS="" +fi go install -trimpath -ldflags "$FLAGS" -v $PWD/`dirname $0`/cmd/... |