2026-10-24 10:37:46 +02:00
|
|
|
#!/usr/bin/env sh
|
2026-10-24 11:15:35 +02:00
|
|
|
# Builds the talk release artifacts for all target platforms, reproducibly
|
|
|
|
|
# with nothing but the Go toolchain (no GoReleaser needed; this way the same
|
|
|
|
|
# step runs identically locally, in Gitea Actions and in nix).
|
2026-10-24 10:37:46 +02:00
|
|
|
#
|
2026-10-24 11:15:35 +02:00
|
|
|
# Asset contract (agent-lib pattern, the fleet rollout pins to it):
|
|
|
|
|
# dist/talk_<os>_<arch>[.exe] static binary, CGO_ENABLED=0
|
|
|
|
|
# dist/checksums.txt sha256 per asset (sha256sum format)
|
2026-10-24 10:37:46 +02:00
|
|
|
#
|
2026-10-24 11:15:35 +02:00
|
|
|
# Usage: scripts/release.sh [VERSION] (default: git describe, else "dev")
|
|
|
|
|
# Env: TARGETS="linux/amd64 ..." overrides the matrix.
|
2026-10-24 10:37:46 +02:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
VERSION="${1:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
|
|
|
|
|
VERSION="${VERSION#v}"
|
|
|
|
|
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
|
|
|
|
|
TARGETS="${TARGETS:-linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64}"
|
|
|
|
|
DIST=dist
|
|
|
|
|
|
|
|
|
|
rm -rf "$DIST"
|
|
|
|
|
mkdir -p "$DIST"
|
|
|
|
|
for target in $TARGETS; do
|
|
|
|
|
os="${target%/*}"
|
|
|
|
|
arch="${target#*/}"
|
|
|
|
|
out="$DIST/talk_${os}_${arch}"
|
|
|
|
|
[ "$os" = windows ] && out="$out.exe"
|
|
|
|
|
echo "build $out"
|
|
|
|
|
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath \
|
|
|
|
|
-ldflags "-s -w -X main.version=$VERSION -X main.commit=$COMMIT" \
|
|
|
|
|
-o "$out" ./cmd/talk
|
|
|
|
|
done
|
|
|
|
|
(cd "$DIST" && sha256sum talk_* > checksums.txt)
|
|
|
|
|
echo
|
|
|
|
|
echo "Version $VERSION ($COMMIT):"
|
|
|
|
|
cat "$DIST/checksums.txt"
|