name: docs
on:
  push:
    branches:
      - docs
      - develop
      - main
    paths:
      # Only rebuild website when docs have changed
      - 'README.md'
      - 'docs/**'
      - 'mkdocs.yml'
      - .github/**

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout master
        uses: actions/checkout@v4

      - name: Set up Python 3.x
        uses: actions/setup-python@v5
        with:
          python-version: 3.x
      - run: pip install mkdocs-material mkdocs-mermaid2-plugin mkdocs-jupyter legacy-cgi pdocs
      - run: pip install .
      - run: pdocs as_markdown --output_dir ./docs/api/latest --exclude_source --overwrite ogc_api_records_core_client
      - run: mkdocs gh-deploy --force
