name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Install packages
      run: |
        sudo apt-get -y update
        sudo apt-get -y install ocaml-nox ocaml-findlib dune menhir texlive-latex-base texlive-pictures texlive-latex-extra
    - name: Build
      run: make test
    - name: Generate website
      run: |
        sudo apt-get -y install pandoc
        make -C website
    - name: Upload website artifact
      uses: actions/upload-pages-artifact@v2
      with:
        path: website
  deploy:
    needs: build
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy website
        id: deployment
        uses: actions/deploy-pages@v2
