| 1 | name: Deploy Documentation |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | paths: |
| 8 | - 'docs/**' |
| 9 | - 'mkdocs.yml' |
| 10 | - '.github/workflows/docs.yml' |
| 11 | workflow_dispatch: # Allow manual trigger |
| 12 | |
| 13 | permissions: |
| 14 | contents: write |
| 15 | |
| 16 | jobs: |
| 17 | deploy: |
| 18 | runs-on: ubuntu-latest |
| 19 | steps: |
| 20 | - name: Checkout code |
| 21 | uses: actions/checkout@v4 |
| 22 | with: |
| 23 | fetch-depth: 0 # Fetch all history for git-revision-date-localized plugin |
| 24 | |
| 25 | - name: Setup Python |
| 26 | uses: actions/setup-python@v5 |
| 27 | with: |
| 28 | python-version: '3.12' |
| 29 | |
| 30 | - name: Cache dependencies |
| 31 | uses: actions/cache@v4 |
| 32 | with: |
| 33 | path: ~/.cache/pip |
| 34 | key: ${{ runner.os }}-pip-${{ hashFiles('requirements-docs.txt') }} |
| 35 | restore-keys: | |
| 36 | ${{ runner.os }}-pip- |
| 37 | |
| 38 | - name: Install dependencies |
| 39 | run: | |
| 40 | pip install --upgrade pip |
| 41 | pip install -r requirements-docs.txt |
| 42 | |
| 43 | - name: Build and deploy documentation |
| 44 | run: mkdocs gh-deploy --force |
| 45 | |
| 46 |