---
name: Documentation

on:
  push:
    branches:
      - master

concurrency:
  cancel-in-progress: true
  group: pages

defaults:
  run:
    shell: bash

jobs:
  docs:
    runs-on: ubuntu-24.04

    permissions:
      contents: read
      id-token: write
      pages: write

    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false

      - uses: cachix/install-nix-action@v31

      - uses: cachix/cachix-action@v16
        with:
          name: nix-community
          authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
        continue-on-error: true

      - run: nix build .#doc

      - uses: actions/upload-pages-artifact@v4
        with:
          path: result

      - uses: actions/deploy-pages@v4
