# Nova Slides Render — re-renders presentation deck when source files change.
# REQ-273: install python-pptx, pin CLI versions, stage HTML + both PPTX +
# base64-inlined images.
name: Nova Slides Render
on:
  push:
    paths:
      - 'docs/presentations/**'
      - 'scripts/render_slides.sh'
      - 'scripts/inline_images.py'
      - 'scripts/render_pptx.py'
      - 'pyproject.toml'
  workflow_dispatch:

jobs:
  render:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - uses: actions/setup-python@v5
        with:
          python-version: '3.10'
      - name: Install python-pptx (slides extra)
        run: pip install -e ".[slides]"
      - name: Install + pin render CLIs
        run: |
          npx --yes @marp-team/marp-cli@4.5.0 --version
          npx --yes @mermaid-js/mermaid-cli@11.16.0 --version
      - name: Render slides
        run: bash scripts/render_slides.sh
      - name: Commit rendered artifacts
        run: |
          git config user.name "nova-slides-bot"
          git config user.email "bot@nova.local"
          git add docs/presentations/*.html \
                  docs/presentations/*.pptx \
                  docs/presentations/*-python.pptx \
                  docs/presentations/assets/png/*.png
          git diff --cached --quiet || git commit -m "chore(slides): re-render deck [skip ci]"
          git push