Files
talk/scripts/release.sh
T
m3ta-chironandClaude Fable 5.1 423377bade build: Release-Pipeline (scripts/release.sh + Gitea-Workflow) und flake.nix
- scripts/release.sh baut die sechs Targets (linux/darwin/windows ×
  amd64/arm64) statisch mit CGO_ENABLED=0, -trimpath, Version und Commit
  per ldflags, und schreibt checksums.txt. Asset-Vertrag für das Fleet-
  Rollout: talk_<os>_<arch>[.exe]. Bewusst ohne GoReleaser — dasselbe
  Artefakt lokal, in CI und unter nix, ohne zusätzliches Werkzeug.
- .gitea/workflows/release.yml: bei Tag v* Tests, Build, Gitea-Release mit
  Assets (actions/gitea-release-action, Repo-Token).
- flake.nix: Paket (buildGoModule, ein Binary), App, Overlay, devShell,
  Formatter. Linux-Wrapper legt alsa-lib in den LD_LIBRARY_PATH (oto lädt
  ALSA per dlopen, spricht PulseAudio/PipeWire aber direkt in Go) und
  espeak-ng/libnotify in den PATH. Verifiziert: nix build .#talk, nix flake
  check, Snapshot-Build aller sechs Targets.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 10:37:46 +02:00

37 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env sh
# Baut die Release-Artefakte von talk für alle Zielplattformen — reproduzierbar
# mit nichts als dem Go-Toolchain (kein GoReleaser nötig; so läuft derselbe
# Schritt lokal, in Gitea Actions und in nix identisch).
#
# Asset-Vertrag (agent-lib-Muster, Fleet-Rollout pinnt darauf):
# dist/talk_<os>_<arch>[.exe] statisches Binary, CGO_ENABLED=0
# dist/checksums.txt sha256 je Asset (sha256sum-Format)
#
# Aufruf: scripts/release.sh [VERSION] (Default: git describe, sonst "dev")
# Env: TARGETS="linux/amd64 …" überschreibt die Matrix.
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"