name: Build PDF

on:
  push:
    branches: [ main, master ]
  pull_request:
  workflow_dispatch:

jobs:
  pdf:
    name: make pdf
    runs-on: ubuntu-latest
    container:
      image: golang:1.22-bookworm
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Chromium and tools
        run: |
          apt-get update
          DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
            make chromium ca-certificates fonts-liberation
          rm -rf /var/lib/apt/lists/*

      - name: Build PDF
        run: make pdf

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: output-pdf
          path: _dist/output.pdf
          if-no-files-found: error

