|
1 | | -name: Documentation |
| 1 | +name: Build and Deploy Documentation |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - master |
| 5 | + branches: [master] |
| 6 | + paths: |
| 7 | + - 'docs/**' |
| 8 | + - 'mkdocs.yml' |
| 9 | + - '.github/workflows/build-docs.yml' |
| 10 | + pull_request: |
| 11 | + branches: [master] |
| 12 | + paths: |
| 13 | + - 'docs/**' |
| 14 | + - 'mkdocs.yml' |
| 15 | + - '.github/workflows/build-docs.yml' |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: pages |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + pages: write |
| 27 | + id-token: write |
7 | 28 |
|
8 | 29 | jobs: |
9 | | - docs: |
| 30 | + build: |
| 31 | + name: Build Documentation |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + |
| 39 | + - name: Set up Python |
| 40 | + uses: actions/setup-python@v5 |
| 41 | + with: |
| 42 | + python-version: '3.12' |
| 43 | + cache: 'pip' |
| 44 | + cache-dependency-path: 'pyproject.toml' |
| 45 | + |
| 46 | + - name: Install dependencies |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade pip |
| 49 | + pip install -e .[dev] |
| 50 | +
|
| 51 | + - name: Verify MkDocs configuration |
| 52 | + run: mkdocs config |
| 53 | + |
| 54 | + - name: Build documentation |
| 55 | + run: mkdocs build |
| 56 | + |
| 57 | + - name: Upload Pages artifact |
| 58 | + if: github.ref == 'refs/heads/master' |
| 59 | + uses: actions/upload-pages-artifact@v4 |
| 60 | + with: |
| 61 | + path: ./site |
| 62 | + |
| 63 | + deploy: |
| 64 | + name: Deploy to GitHub Pages |
| 65 | + if: github.ref == 'refs/heads/master' && github.event_name == 'push' |
10 | 66 | runs-on: ubuntu-latest |
| 67 | + needs: build |
11 | 68 | environment: |
12 | 69 | name: github-pages |
13 | 70 | url: ${{ steps.deployment.outputs.page_url }} |
14 | | - permissions: |
15 | | - contents: read |
16 | | - pages: write |
17 | | - id-token: write |
18 | 71 | steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - - name: Set up Python |
21 | | - uses: actions/setup-python@v5 |
22 | | - with: |
23 | | - python-version: '3.13' |
24 | | - - name: Install Dependencies |
25 | | - run: | |
26 | | - pip install --upgrade pip |
27 | | - pip install .[dev] |
28 | | - - name: Generate Docs |
29 | | - run: | |
30 | | - mkdocs build |
31 | | - - name: Setup Pages |
32 | | - uses: actions/configure-pages@v4 |
33 | | - - name: Upload artifact |
34 | | - uses: actions/upload-pages-artifact@v4 |
35 | | - with: |
36 | | - name: github-pages-docs |
37 | | - path: './site' |
38 | | - - name: Deploy to GitHub Pages |
39 | | - id: deployment |
40 | | - uses: actions/deploy-pages@v4 |
| 72 | + - name: Deploy to GitHub Pages |
| 73 | + id: deployment |
| 74 | + uses: actions/deploy-pages@v4 |
0 commit comments