# Save this file as: .github/workflows/deploy.yml
#
# Builds a MkDocs site (with the ontoink plugin) and publishes it to
# GitHub Pages on every push to the default branch.
#
# One-time setup in your repository:
#   Settings -> Pages -> Build and deployment -> Source -> "GitHub Actions"

name: Deploy site

on:
  push:
    branches: [main]        # change to your default branch if different
  workflow_dispatch:        # also allow manual runs from the Actions tab

# Permissions GitHub Pages needs
permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: pages
  cancel-in-progress: false

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install MkDocs + ontoink
        run: pip install mkdocs-material ontoink

      - name: Build the site
        run: mkdocs build   # outputs to ./site

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: site

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
