Files
tessera/scripts/export-public.sh
Adnan Zahir 854e3572e9 chore: take deployment-specific material out of the repository for the first release
- MBU parity map, cutover runbook and the tasks/ planning notes move outside the repo
- tests/mbu becomes tests/fixtures with generic application names and no placement inventory
- test fixtures in Rust and web use neutral names
- scripts/export-public.sh checks an external list of private terms instead of naming them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:50:27 +07:00

23 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build a clean, single-commit tree of the current HEAD for a fresh public repository. Nothing is pushed.
# Usage: [TESSERA_PRIVATE_TERMS=/path/to/terms.txt] scripts/export-public.sh /path/to/empty-dir
#
# TESSERA_PRIVATE_TERMS names a file, kept outside the repository, with one term per line (host names,
# customer names, internal systems). If any of them occurs in the exported tree the export is refused.
set -euo pipefail
out="${1:?target directory}"
[ -z "$(ls -A "$out" 2>/dev/null)" ] || { echo "target must be empty" >&2; exit 1; }
root="$(git rev-parse --show-toplevel)"
git -C "$root" diff --quiet HEAD || { echo "commit or stash first" >&2; exit 1; }
git -C "$root" archive HEAD | tar -x -C "$out"
if [ -n "${TESSERA_PRIVATE_TERMS:-}" ]; then
if grep -rIl -i -F -f "$TESSERA_PRIVATE_TERMS" "$out" --exclude-dir=node_modules >/dev/null; then
echo "private terms found in:" >&2
grep -rIl -i -F -f "$TESSERA_PRIVATE_TERMS" "$out" --exclude-dir=node_modules >&2
exit 1
fi
else
echo "note: TESSERA_PRIVATE_TERMS is not set, so no check for private terms was made" >&2
fi
echo "clean tree at $out; review it, then: git init && git add -A && git commit"