Files
sow-tools/scripts/build-binaries.sh
T

24 lines
747 B
Bash
Executable File

#!/usr/bin/env bash
# Build every Crucible binary in cmd/ into ./bin.
#
# Replaces the old single-binary build-tool.sh. Outputs are gitignored — they
# are CI artifacts / image layers, never committed (D19). The short git sha is
# stamped into the version via -ldflags.
set -euo pipefail
cd "$(dirname "$0")/.."
sha="$(git rev-parse --short=12 HEAD 2>/dev/null || echo unknown)"
ldflags="-X gitea.westgate.pw/ShadowsOverWestgate/sow-tools/internal/buildinfo.Version=${sha}"
mkdir -p bin .cache/go-build
export GOCACHE="${PWD}/.cache/go-build"
for dir in ./cmd/*/; do
name="$(basename "$dir")"
echo "building ${name}"
go build -trimpath -ldflags "${ldflags}" -o "bin/${name}" "${dir}"
done
echo "built into ./bin: $(cd bin && echo *)"