#!/bin/bash # Gather build metadata. VERSION="$(git tag --points-at)" || true test -z "$VERSION" && DEV_VERSION="$(git describe --tags --first-parent --abbrev=0)" || true test -n "$DEV_VERSION" && VERSION="${DEV_VERSION}_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 export CGO_ENABLED=0 BUILD_PATH="github.com/safing/portmaster/base/info" go build -ldflags "-X github.com/safing/portmaster/base/info.version=${VERSION} -X github.com/safing/portmaster/base/info.buildSource=${SOURCE} -X github.com/safing/portmaster/base/info.buildTime=${BUILD_TIME}" "$@"