77 types :
88 - opened
99 - synchronize
10- workflow_dispatch :
11- inputs :
12- debug_enabled :
13- description : ' Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
14- required : false
15- default : false
1610jobs :
11+ changes :
12+ runs-on : ubuntu-latest
13+ # Required permissions
14+ permissions :
15+ pull-requests : read
16+ # Set job outputs to values from filter step
17+ outputs :
18+ docs : ${{ steps.filter.outputs.docs }}
19+ steps :
20+ - uses : actions/checkout@v3
21+ # For pull requests it's not necessary to checkout the code but for the main branch it is
22+ - uses : dorny/paths-filter@v2
23+ id : filter
24+ with :
25+ filters : |
26+ docs:
27+ - README.md
28+ - docs/**
29+ - docs_src/**
30+ - pyproject.toml
31+ - mkdocs.yml
32+ - mkdocs.insiders.yml
33+
1734 build-docs :
35+ needs :
36+ - changes
37+ if : ${{ needs.changes.outputs.docs == 'true' }}
1838 runs-on : ubuntu-latest
1939 steps :
2040 - name : Dump GitHub context
@@ -26,18 +46,12 @@ jobs:
2646 uses : actions/setup-python@v4
2747 with :
2848 python-version : " 3.11"
29- # Allow debugging with tmate
30- - name : Setup tmate session
31- uses : mxschmitt/action-tmate@v3
32- if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
33- with :
34- limit-access-to-actor : true
3549 - uses : actions/cache@v3
3650 id : cache
3751 with :
3852 path : ${{ env.pythonLocation }}
39- key : ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-docs-v2
40- - name : Install poetry
53+ key : ${{ runner.os }}-python-docs- ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01
54+ - name : Install Poetry
4155 if : steps.cache.outputs.cache-hit != 'true'
4256 run : |
4357 python -m pip install --upgrade pip
@@ -61,19 +75,20 @@ jobs:
6175 - name : Build Docs with Insiders
6276 if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
6377 run : python -m poetry run mkdocs build --config-file mkdocs.insiders.yml
64- - name : Zip docs
65- run : python -m poetry run bash ./scripts/zip-docs.sh
6678 - uses : actions/upload-artifact@v3
6779 with :
68- name : docs-zip
69- path : ./site/docs.zip
70- - name : Deploy to Netlify
71- 80+ name : docs-site
81+ path : ./site/**
82+
83+ # https://github.com/marketplace/actions/alls-green#why
84+ docs-all-green : # This job does nothing and is only used for the branch protection
85+ if : always()
86+ needs :
87+ - build-docs
88+ runs-on : ubuntu-latest
89+ steps :
90+ - name : Decide whether the needed jobs succeeded or failed
91+ uses : re-actors/alls-green@release/v1
7292 with :
73- publish-dir : ' ./site'
74- production-branch : main
75- github-token : ${{ secrets.GITHUB_TOKEN }}
76- enable-commit-comment : false
77- env :
78- NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
79- NETLIFY_SITE_ID : ${{ secrets.NETLIFY_SITE_ID }}
93+ jobs : ${{ toJSON(needs) }}
94+ allowed-skips : build-docs
0 commit comments