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
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
for ARCH in "${JOBS[@]}"; do
|
# Get version information
|
||||||
goreleaser build \
|
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.x")
|
||||||
--clean \
|
STEPS=$(git rev-list --count ${VERSION}..HEAD 2>/dev/null || echo "0")
|
||||||
--snapshot \
|
if [ "$STEPS" -gt "0" ]; then
|
||||||
--output "./dist/" \
|
VERSION="${VERSION}-${STEPS}"
|
||||||
--config "./.goreleaser-linux-$(resolveArch "${ARCH}").yml"
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
|
# 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