#!/usr/bin/env bash # scripts/render_deck.sh — render a Marp deck to HTML + PPTX, commit both to git. # REQ-228 (v1.18): PPTX is now a first-class committed artifact + release attachment. # # Usage: # bash scripts/render_deck.sh # bash scripts/render_deck.sh nova-autonomous-cloud-delivery # # Renders: # docs/presentations/-marp.md → docs/presentations/.html (committed) # → docs/presentations/.pptx (committed, binary) # # The PPTX is also attached to the current phase's Gitea release via # scripts/attach_release_asset.py (call separately after ship, or this script # will invoke it if NOVA_GITEA_RELEASE_ID is set). set -euo pipefail DECK="${1:?Usage: render_deck.sh }" cd "$(git rev-parse --show-toplevel)" SRC="docs/presentations/${DECK}-marp.md" HTML="docs/presentations/${DECK}.html" PPTX="docs/presentations/${DECK}.pptx" if [ ! -f "$SRC" ]; then echo "ERROR: source deck $SRC not found" >&2; exit 1 fi CHROME="" for c in \ /root/.cache/ms-playwright/chromium-1217/chrome-linux64/chrome \ /usr/bin/chromium \ /usr/bin/chromium-browser \ /usr/bin/google-chrome; do if [ -x "$c" ]; then CHROME="$c"; break; fi done if [ -z "$CHROME" ]; then echo "WARNING: no Chrome/Chromium found — skipping render (HTML/PPTX will need manual re-render)" >&2 exit 0 fi export CHROME_PATH="$CHROME" echo "Rendering HTML → $HTML" npx --yes @marp-team/marp-cli@latest --allow-local-files "$SRC" -o "$HTML" 2>&1 | tail -3 echo "Rendering PPTX → $PPTX" npx --yes @marp-team/marp-cli@latest --allow-local-files "$SRC" -o "$PPTX" 2>&1 | tail -3 git add "$HTML" "$PPTX" echo "Staged $HTML + $PPTX for commit." if [ -n "${NOVA_GITEA_RELEASE_ID:-}" ]; then echo "Attaching PPTX to Gitea release $NOVA_GITEA_RELEASE_ID..." python3 scripts/attach_release_asset.py "$PPTX" "$NOVA_GITEA_RELEASE_ID" || \ echo "WARNING: attach failed — PPTX is still committed; attach manually." fi