name: Deploy Documentation GitHub Pages

on:
  push:
    branches:
      - "main"

  # Trigger on request.
  workflow_dispatch:

jobs:
  deploy-documentation-github-pages:
    runs-on: ubuntu-latest
    container: gpuci/cccl:cuda11.7.0-devel-ubuntu20.04-gcc9
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Generate documentation markdown
        run: ./docs/generate_markdown.bash --clean
      - name: Deploy generated documentation markdown to gh-pages branch
        uses: peaceiris/actions-gh-pages@v3
        if: github.ref == 'refs/heads/main'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./build_docs/github_pages
          enable_jekyll: true
          commit_message: "Deploy Documentation: ${{ github.event.head_commit.message }}"
