2e97c3b931
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
22 lines
910 B
Bash
Executable File
22 lines
910 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build release archives into dist/ for the given version (for example v0.1.0).
|
|
# Pure Go, no cgo, so every target cross-compiles from one host.
|
|
set -euo pipefail
|
|
ver="${1:?usage: scripts/release.sh vX.Y.Z}"
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
out="$root/dist"
|
|
rm -rf "$out" && mkdir -p "$out"
|
|
cd "$root"
|
|
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
|
|
os="${target%/*}"; arch="${target#*/}"
|
|
name="playbook_${ver}_${os}_${arch}"
|
|
bin="playbook"; [ "$os" = windows ] && bin="playbook.exe"
|
|
stage="$(mktemp -d)"
|
|
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags "-s -w -X main.version=$ver" -o "$stage/$bin" ./cmd/playbook
|
|
cp LICENSE README.md "$stage/"
|
|
tar -C "$stage" -czf "$out/$name.tar.gz" "$bin" LICENSE README.md
|
|
rm -rf "$stage"
|
|
done
|
|
(cd "$out" && sha256sum playbook_* > checksums.txt)
|
|
ls -1 "$out"
|