mirror of
https://github.com/openziti/zrok.git
synced 2025-06-24 19:51:32 +02:00
local cross-build with accurate version metadata
This commit is contained in:
parent
d2c92651ef
commit
97ca59a750
@ -40,11 +40,26 @@ fi
|
||||
done
|
||||
)
|
||||
|
||||
for ARCH in "${JOBS[@]}"; do
|
||||
goreleaser build \
|
||||
--clean \
|
||||
--snapshot \
|
||||
--output "./dist/" \
|
||||
--config "./.goreleaser-linux-$(resolveArch "${ARCH}").yml"
|
||||
done
|
||||
# Get version information
|
||||
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.x")
|
||||
STEPS=$(git rev-list --count ${VERSION}..HEAD 2>/dev/null || echo "0")
|
||||
if [ "$STEPS" -gt "0" ]; then
|
||||
VERSION="${VERSION}-${STEPS}"
|
||||
fi
|
||||
|
||||
# Check if working copy is dirty
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
# Clean working directory
|
||||
HASH=$(git rev-parse --short HEAD)
|
||||
else
|
||||
# Dirty working directory
|
||||
HASH="developer build"
|
||||
fi
|
||||
|
||||
for ARCH in "${JOBS[@]}"; do
|
||||
LDFLAGS="-s -w -X 'github.com/openziti/zrok/build.Version=${VERSION}' -X 'github.com/openziti/zrok/build.Hash=${HASH}'"
|
||||
GOOS=linux GOARCH=$(resolveArch "${ARCH}") \
|
||||
go build -o "./dist/$(resolveArch "${ARCH}")/linux/zrok" \
|
||||
-ldflags "${LDFLAGS}" \
|
||||
./cmd/zrok
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user