|
1 | | -# GitHub Actions workflow to deploy the website to GitHub Pages |
2 | | - |
3 | | -name: Deploy to GitHub Pages |
| 1 | +name: Documentation |
4 | 2 |
|
5 | 3 | on: |
6 | | - # Runs on pushes targeting the default branch |
7 | 4 | push: |
8 | 5 | branches: ["master"] |
9 | 6 | paths: |
10 | 7 | - 'docs/**' |
11 | 8 | - '.github/workflows/deploy-pages.yml' |
12 | | - |
13 | | - # Allows you to run this workflow manually from the Actions tab |
14 | 9 | workflow_dispatch: |
15 | 10 |
|
16 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
17 | 11 | permissions: |
18 | 12 | contents: read |
19 | 13 | pages: write |
20 | 14 | id-token: write |
21 | 15 |
|
22 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
23 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
24 | | -concurrency: |
25 | | - group: "pages" |
26 | | - cancel-in-progress: false |
27 | | - |
28 | 16 | jobs: |
29 | | - # Build job |
30 | | - build: |
| 17 | + docs: |
31 | 18 | runs-on: ubuntu-latest |
32 | | - steps: |
33 | | - - name: Checkout |
34 | | - uses: actions/checkout@v4 |
35 | | - |
36 | | - - name: Setup Pages |
37 | | - uses: actions/configure-pages@v4 |
38 | | - |
39 | | - - name: Upload artifact |
40 | | - uses: actions/upload-pages-artifact@v3 |
41 | | - with: |
42 | | - # Upload the docs folder |
43 | | - path: './docs' |
44 | | - |
45 | | - # Deployment job |
46 | | - deploy: |
47 | 19 | environment: |
48 | 20 | name: github-pages |
49 | 21 | url: ${{ steps.deployment.outputs.page_url }} |
50 | | - runs-on: ubuntu-latest |
51 | | - needs: build |
| 22 | + |
52 | 23 | steps: |
53 | | - - name: Deploy to GitHub Pages |
54 | | - id: deployment |
55 | | - uses: actions/deploy-pages@v4 |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 2 |
| 27 | + |
| 28 | + - name: Setup Python |
| 29 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 30 | + uses: actions/setup-python@v4 |
| 31 | + with: |
| 32 | + python-version: 3.x |
| 33 | + |
| 34 | + - name: Install MkDocs |
| 35 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 36 | + run: | |
| 37 | + pip install mkdocs-material |
| 38 | + pip install mkdocs-git-revision-date-plugin |
| 39 | +
|
| 40 | + - name: Build documentation |
| 41 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 42 | + run: | |
| 43 | + cd docs |
| 44 | + mkdocs build |
| 45 | + cd .. |
| 46 | + mv docs/site . |
| 47 | + cp docs/.nojekyll site/ |
| 48 | + cp docs/CNAME site/CNAME |
| 49 | +
|
| 50 | + - name: Setup Pages |
| 51 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 52 | + uses: actions/configure-pages@v4 |
| 53 | + with: |
| 54 | + enablement: true |
| 55 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Upload artifact |
| 58 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 59 | + uses: actions/upload-pages-artifact@v3 |
| 60 | + with: |
| 61 | + path: ./site |
| 62 | + |
| 63 | + - name: Deploy to GitHub Pages |
| 64 | + if: steps.check-docs.outputs.has_changes == 'true' |
| 65 | + id: deployment |
| 66 | + uses: actions/deploy-pages@v4 |
| 67 | + with: |
| 68 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + branch: gh-pages |
| 70 | + folder: site |
0 commit comments