#!/bin/bash # build_site.sh — pull the images the docs reference from the artifact registry # (if not already present locally), stage them under docs/assets/, then build # the MkDocs site. The built site/ output is what gets pushed to gitea-pages — # never the source images themselves (see scripts/artifacts/push_artifacts.sh). set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$REPO_ROOT" ASSETS_DIR="docs/assets/images" mkdir -p "$ASSETS_DIR" # Frames referenced by docs/rep4-optimizer-results.md. Pull the film's montage # frames from the registry if this machine doesn't already have them locally. FRAMES_ROOT="experiments/results/holdout/frames" if [ ! -d "$FRAMES_ROOT/many_saints" ] || [ ! -d "$FRAMES_ROOT/downton_abbey" ]; then echo "==> pulling montage frames (not found locally)..." scripts/artifacts/pull_artifacts.sh montage-frames Many_Saints_of_Newark || true scripts/artifacts/pull_artifacts.sh montage-frames Downton_Abbey__A_New_Era || true fi echo "==> staging referenced frames into ${ASSETS_DIR}" cp -v "${FRAMES_ROOT}/many_saints/fpi/fpi_t03543.jpg" \ "${ASSETS_DIR}/many_saints_ghost_fpi.jpg" cp -v "${FRAMES_ROOT}/downton_abbey/fpi/fpi_t07242.jpg" \ "${ASSETS_DIR}/downton_abbey_ghost_fpi.jpg" if [ ! -d experiments/galleries ] || [ -z "$(ls -A experiments/galleries 2>/dev/null)" ]; then echo "==> pulling galleries (not found locally)..." scripts/artifacts/pull_artifacts.sh galleries fi echo "==> generating calibration curve chart" python3 scripts/docs/calibration_chart.py --out "${ASSETS_DIR}/calibration_curves.png" echo "==> building site" mkdocs build echo "==> done. site/ is ready to deploy to the gitea-pages branch."