ontoref-outreach/site/update-content.sh
2026-07-17 06:37:52 +01:00

35 lines
2.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Publish this site's tree to the running pod, letting content.nu choose the
# MINIMAL correct action from the changeset's reload class (distro.ncl ::
# reload_classes): hot → no restart · restart → snapshot + rolling restart ·
# rebuild → refused (that one needs a new image, not content).
#
# ./update-content.sh # classify + publish what changed since HEAD~1
# ./update-content.sh --all # SEND EVERYTHING — the whole deliverable tree,
# # for when the pod's state is not trusted (a bad
# # commit, a deploy that never landed). The action
# # still follows what CHANGED, not what is sent.
# ./update-content.sh --since <sha> # widen the changeset: what the pod lacks since <sha>
# ./update-content.sh --all --restart # SEND EVERYTHING AND RESTART. For the first delivery
# # of a startup-read file (migrations, config) that
# # git has carried for weeks and so reads as
# # "unchanged" while the pod has never had it.
# ./update-content.sh --dry-run # say what it would do, touch nothing
# ./update-content.sh --namespace x # any content.nu flag passes through
#
# Deploy identity (namespace / app_label / pvc / mount / cp_node) is resolved
# from rustelo.manifest.toml — no literals here.
#
# NOT `sync`: sync packs only the `hot` subset and never restarts, so a change
# under site/config or site/i18n/locales shipped green while the pod kept
# serving the old one.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONTENT_NU="${CONTENT_NU:-$SCRIPT_DIR/../../../website-htmx-rustelo/code/provisioning/content.nu}"
[ -f "$CONTENT_NU" ] || { echo "content.nu not found: $CONTENT_NU" >&2; exit 1; }
# --since is inert while this tree is not its own git root (it lives under the
# outreach repo), so content.nu falls back to a full snapshot on every run.
exec nu "$CONTENT_NU" publish --root "$SCRIPT_DIR" "$@"