Fix version metadata
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Gather build metadata.
|
||||
VERSION=$(git tag --points-at)
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
VERSION=$(git describe --tags --abbrev=0 || echo "dev_build")
|
||||
fi
|
||||
SOURCE=$( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown_source" )
|
||||
BUILD_TIME=$(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown_build_time")
|
||||
VERSION="$(git tag --points-at)"; test -z "$VERSION" && VERSION="$(git describe --tags --abbrev=0)_dev_build"; test -z "$VERSION" && VERSION="dev_build"
|
||||
SOURCE=$( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown" )
|
||||
BUILD_TIME=$(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown")
|
||||
|
||||
# Build
|
||||
CGO_ENABLED=0
|
||||
export CGO_ENABLED=0
|
||||
BUILD_PATH="github.com/safing/portbase/info"
|
||||
go build -ldflags "-X github.com/safing/portbase/info.version=${VERSION} -X github.com/safing/portbase/info.buildSource=${SOURCE} -X github.com/safing/portbase/info.buildTime=${BUILD_TIME}" "$@"
|
||||
|
||||
Reference in New Issue
Block a user