name: mkdocs-material
on:
  push:
    branches:
      - 'main'
      - 'development'

jobs:
  mkdocs-material:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - name: checkout sources
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: setup python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: install requirements
        run: |
          python -m \
            pip install -r docs/requirements-mkdocs.txt

      - name: confirm buildability
        run: |
          python -m \
            mkdocs build \
            --clean \
            --verbose

      - name: deploy to gh-pages
        if: ${{ github.ref == 'refs/heads/main' }}
        run: |
          python -m \
            mkdocs gh-deploy \
            --clean \
            --force