name: Build deck as pdf
on:
  push:
    branches:
      - main

jobs:
  build-pdf:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: latest

      - name: Install Marp CLI
        run: npm install -g @marp-team/marp-cli

      - name: Install chrome requirements
        run: apt update && apt install libnss3 libatk -y

      - name: Setup Chrome
        uses: https://github.com/browser-actions/setup-chrome@v1

      - name: Build PDF
        run: marp main.md --pdf

      - name: Upload output as artifact
        uses: https://gitea.com/actions/upload-artifact@v3
        with:
          name: presentation
          path: slide.pdf
          if-no-files-found: error
          retention-days: 15
