44 branches :
55 - master
66 pull_request :
7- types : [opened, synchronize]
7+ types :
8+ - opened
9+ - synchronize
810jobs :
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 master 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+ - requirements-docs.txt
31+ langs :
32+ needs :
33+ - changes
34+ runs-on : ubuntu-latest
35+ outputs :
36+ langs : ${{ steps.show-langs.outputs.langs }}
37+ steps :
38+ - uses : actions/checkout@v3
39+ - name : Set up Python
40+ uses : actions/setup-python@v4
41+ with :
42+ python-version : " 3.11"
43+ - uses : actions/cache@v3
44+ id : cache
45+ with :
46+ path : ${{ env.pythonLocation }}
47+ key : ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt') }}-v05
48+ - name : Install docs extras
49+ if : steps.cache.outputs.cache-hit != 'true'
50+ run : pip install -r requirements-docs.txt
51+ # Install MkDocs Material Insiders here just to put it in the cache for the rest of the steps
52+ - name : Install Material for MkDocs Insiders
53+ if : ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
54+ run : pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
55+ - name : Export Language Codes
56+ id : show-langs
57+ run : |
58+ echo "langs=$(python ./scripts/docs.py langs-json)" >> $GITHUB_OUTPUT
59+
960 build-docs :
61+ needs :
62+ - changes
63+ - langs
64+ if : ${{ needs.changes.outputs.docs == 'true' }}
1065 runs-on : ubuntu-latest
66+ strategy :
67+ matrix :
68+ lang : ${{ fromJson(needs.langs.outputs.langs) }}
1169 steps :
1270 - name : Dump GitHub context
1371 env :
@@ -22,28 +80,35 @@ jobs:
2280 id : cache
2381 with :
2482 path : ${{ env.pythonLocation }}
25- key : ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
83+ key : ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt' ) }}-v05
2684 - name : Install docs extras
2785 if : steps.cache.outputs.cache-hit != 'true'
28- run : pip install .[doc]
86+ run : pip install -r requirements-docs.txt
2987 - name : Install Material for MkDocs Insiders
3088 if : ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
3189 run : pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
90+ - name : Update Languages
91+ run : python ./scripts/docs.py update-languages
92+ - uses : actions/cache@v3
93+ with :
94+ key : mkdocs-cards-${{ matrix.lang }}-${{ github.ref }}
95+ path : docs/${{ matrix.lang }}/.cache
3296 - name : Build Docs
33- run : python ./scripts/docs.py build-all
34- - name : Zip docs
35- run : bash ./scripts/zip-docs.sh
97+ run : python ./scripts/docs.py build-lang ${{ matrix.lang }}
3698 - uses : actions/upload-artifact@v3
3799 with :
38- name : docs-zip
39- path : ./site/docs.zip
40- - name : Deploy to Netlify
41- 100+ name : docs-site
101+ path : ./site/**
102+
103+ # https://github.com/marketplace/actions/alls-green#why
104+ docs-all-green : # This job does nothing and is only used for the branch protection
105+ if : always()
106+ needs :
107+ - build-docs
108+ runs-on : ubuntu-latest
109+ steps :
110+ - name : Decide whether the needed jobs succeeded or failed
111+ uses : re-actors/alls-green@release/v1
42112 with :
43- publish-dir : ' ./site'
44- production-branch : master
45- github-token : ${{ secrets.GITHUB_TOKEN }}
46- enable-commit-comment : false
47- env :
48- NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
49- NETLIFY_SITE_ID : ${{ secrets.NETLIFY_SITE_ID }}
113+ jobs : ${{ toJSON(needs) }}
114+ allowed-skips : build-docs
0 commit comments