27 lines
1.1 KiB
Bash
27 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Build the self-contained satellite bundle and stamp the git SHA it was built
|
|
# from into dist/VERSION. The satellite reads that file at boot and reports it
|
|
# as its version (see resolveVersion() in satellite/src/index.ts), so the deploy
|
|
# panel can show running-vs-latest drift and confirm a deploy landed.
|
|
#
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
SHA="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
|
|
DIRTY=""
|
|
if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then
|
|
DIRTY="-dirty"
|
|
fi
|
|
VERSION="${SHA}${DIRTY}"
|
|
|
|
# Build from entry.ts, not index.ts: the entrypoint dispatches between booting
|
|
# the server and running the evidence-capture wrapper as a subcommand, so the
|
|
# single artifact hot-deploy ships now carries BOTH. Previously the wrapper lived
|
|
# only at <repo>/bin/ on each node's own checkout, and deploying a satellite left
|
|
# it untouched.
|
|
bun build satellite/src/entry.ts --target=bun --outfile satellite/dist/satellite.js
|
|
printf '%s' "$VERSION" > satellite/dist/VERSION
|
|
|
|
echo "[build:satellite] built version ${VERSION} -> satellite/dist/satellite.js"
|