11name : " 📚 Documentation"
22
3+ # Global environment variables
4+ env :
5+ CONDITION_IS_PUSH : ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') }}
6+ CONDITION_IS_WORKFLOW_RUN : ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
7+ PROJECT_FOLDER : qtribu
8+ PYTHON_VERSION : 3.12
9+
10+ # Allow one concurrent deployment per branch/pr
11+ concurrency :
12+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+ cancel-in-progress : true
14+
315on :
416 push :
517 branches :
2436 workflow_dispatch :
2537
2638 workflow_run :
39+ branches :
40+ - main
2741 workflows :
2842 - " 📦 Packaging & 🚀 Release"
2943 types :
3044 - completed
3145
32- # Allow one concurrent deployment per branch/pr
33- concurrency :
34- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
35- cancel-in-progress : true
36-
37- env :
38- PROJECT_FOLDER : " qtribu"
39- PYTHON_VERSION : 3.9
40-
4146# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
4247permissions :
4348 contents : read
5964 cache-dependency-path : " requirements/documentation.txt"
6065 python-version : ${{ env.PYTHON_VERSION }}
6166
67+ - name : Cache Sphinx cache
68+ uses : actions/cache@v4
69+ with :
70+ path : docs/_build/cache
71+ key : ${{ runner.os }}-sphinx-${{ hashFiles('docs/**/*') }}
72+ restore-keys : |
73+ ${{ runner.os }}-sphinx-
74+
6275 - name : Install dependencies
6376 run : |
6477 python -m pip install --upgrade pip setuptools wheel
@@ -70,13 +83,13 @@ jobs:
7083 - name : Save build doc as artifact
7184 uses : actions/upload-artifact@v6
7285 with :
86+ if-no-files-found : error
7387 name : documentation
7488 path : docs/_build/html/*
75- if-no-files-found : error
7689 retention-days : 30
7790
7891 - name : Download artifact from build workflow
79- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
92+ if : ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
8093 uses : dawidd6/action-download-artifact@v12
8194 with :
8295 allow_forks : false
@@ -91,15 +104,15 @@ jobs:
91104
92105 - name : Setup Pages
93106 uses : actions/configure-pages@v5
94- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
107+ if : ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
95108
96109 - name : Upload artifact
97110 uses : actions/upload-pages-artifact@v4
98- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
111+ if : ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
99112 with :
100113 path : docs/_build/html/
101114
102115 - name : Deploy to GitHub Pages
103116 id : deployment
104- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
117+ if : ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
105118 uses : actions/deploy-pages@v4
0 commit comments