name: Docs

# Trigger the workflow on push or pull request
on:
  push:
    branches:
      - main
      - master
  pull_request:

# the `concurrency` settings ensure that not too many CI jobs run in parallel
concurrency:
  # group by workflow and ref; the last slightly strange component ensures that for pull
  # requests, we limit to 1 concurrent job, but for the default repository branch we don't
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref_name != github.event.repository.default_branch || github.run_number }}
  # Cancel intermediate builds, but only if it is a pull request build.
  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
  manual:
    name: Build manuals
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6
      - uses: gap-actions/setup-gap@v3
      - uses: gap-actions/build-pkg-docs@v2
        with:
          use-latex: 'true'
      - name: 'Upload documentation'
        uses: actions/upload-artifact@v4
        with:
          name: manual
          path: ./doc/manual.pdf
          if-no-files-found: error
