1- run-name : build ${{ github.event. inputs.repository }}:${{ github.event. inputs.reference }}
1+ run-name : build ${{ inputs.repository }}:${{ inputs.reference }}
22on :
33 workflow_dispatch :
44 inputs :
1818 description : ' Publish to GitHub Pages'
1919 required : false
2020 default : false
21+ python_version :
22+ description : ' Python version used to generate docs'
23+ required : false
24+ default : ' 3'
25+ workflow_call :
26+ inputs :
27+ reference :
28+ description : ' Commit reference from CPython repository'
29+ default : ' 3.14'
30+ type : string
31+ dist_version :
32+ description : ' Dist version (compatible with patchlevel.py output)'
33+ default : ' 3.14'
34+ type : string
35+ repository :
36+ description : ' Repository to checkout'
37+ default : ' python/cpython'
38+ type : string
39+ publish :
40+ description : ' Publish to GitHub Pages'
41+ default : ' false'
42+ type : string
43+ python_version :
44+ description : ' Python version used to generate docs'
45+ default : ' 3'
46+ type : string
2147permissions :
2248 contents : write
2349jobs :
@@ -26,63 +52,63 @@ jobs:
2652 steps :
2753 - uses : actions/setup-python@master
2854 with :
29- python-version : 3
55+ python-version : ${{ inputs.python_version }}
3056 - uses : actions/checkout@master
3157 with :
32- repository : ${{ github.event. inputs.repository }}
33- ref : ${{ github.event. inputs.reference }}
58+ repository : ${{ inputs.repository }}
59+ ref : ${{ inputs.reference }}
3460 - run : make venv
3561 working-directory : ./Doc
3662 - run : make dist-html
3763 working-directory : ./Doc
3864 - uses : actions/upload-artifact@master
3965 if : always()
4066 with :
41- name : docs-html.zip
42- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-html.zip
67+ name : python-${{ inputs.dist_version }}- docs-html.zip
68+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-html.zip
4369 if-no-files-found : ignore
4470 - uses : actions/upload-artifact@master
4571 if : always()
4672 with :
47- name : docs-html.tar.bz2
48- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-html.tar.bz2
73+ name : python-${{ inputs.dist_version }}- docs-html.tar.bz2
74+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-html.tar.bz2
4975 if-no-files-found : ignore
5076 build-text :
5177 runs-on : ubuntu-latest
5278 steps :
5379 - uses : actions/setup-python@master
5480 with :
55- python-version : 3
81+ python-version : ${{ inputs.python_version }}
5682 - uses : actions/checkout@master
5783 with :
58- repository : ${{ github.event. inputs.repository }}
59- ref : ${{ github.event. inputs.reference }}
84+ repository : ${{ inputs.repository }}
85+ ref : ${{ inputs.reference }}
6086 - run : make venv
6187 working-directory : ./Doc
6288 - run : make dist-text
6389 working-directory : ./Doc
6490 - uses : actions/upload-artifact@master
6591 if : always()
6692 with :
67- name : docs-text.zip
68- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-text.zip
93+ name : python-${{ inputs.dist_version }}- docs-text.zip
94+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-text.zip
6995 if-no-files-found : ignore
7096 - uses : actions/upload-artifact@master
7197 if : always()
7298 with :
73- name : docs-text.tar.bz2
74- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-text.tar.bz2
99+ name : python-${{ inputs.dist_version }}- docs-text.tar.bz2
100+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-text.tar.bz2
75101 if-no-files-found : ignore
76102 build-texinfo :
77103 runs-on : ubuntu-latest
78104 steps :
79105 - uses : actions/setup-python@master
80106 with :
81- python-version : 3
107+ python-version : ${{ inputs.python_version }}
82108 - uses : actions/checkout@master
83109 with :
84- repository : ${{ github.event. inputs.repository }}
85- ref : ${{ github.event. inputs.reference }}
110+ repository : ${{ inputs.repository }}
111+ ref : ${{ inputs.reference }}
86112 - run : make venv
87113 working-directory : ./Doc
88114 - run : sudo apt-get update && sudo apt-get install -y texinfo
@@ -91,45 +117,45 @@ jobs:
91117 - uses : actions/upload-artifact@master
92118 if : always()
93119 with :
94- name : docs-texinfo.zip
95- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-texinfo.zip
120+ name : python-${{ inputs.dist_version }}- docs-texinfo.zip
121+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-texinfo.zip
96122 if-no-files-found : ignore
97123 - uses : actions/upload-artifact@master
98124 if : always()
99125 with :
100- name : docs-texinfo.tar.bz2
101- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-texinfo.tar.bz2
126+ name : python-${{ inputs.dist_version }}- docs-texinfo.tar.bz2
127+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-texinfo.tar.bz2
102128 if-no-files-found : ignore
103129 build-epub :
104130 runs-on : ubuntu-latest
105131 steps :
106132 - uses : actions/setup-python@master
107133 with :
108- python-version : 3
134+ python-version : ${{ inputs.python_version }}
109135 - uses : actions/checkout@master
110136 with :
111- repository : ${{ github.event. inputs.repository }}
112- ref : ${{ github.event. inputs.reference }}
137+ repository : ${{ inputs.repository }}
138+ ref : ${{ inputs.reference }}
113139 - run : make venv
114140 working-directory : ./Doc
115141 - run : make dist-epub
116142 working-directory : ./Doc
117143 - uses : actions/upload-artifact@master
118144 if : always()
119145 with :
120- name : docs.epub
121- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs.epub
146+ name : python-${{ inputs.dist_version }}- docs.epub
147+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs.epub
122148 if-no-files-found : ignore
123149 build-pdf :
124150 runs-on : ubuntu-latest
125151 steps :
126152 - uses : actions/setup-python@master
127153 with :
128- python-version : 3
154+ python-version : ${{ inputs.python_version }}
129155 - uses : actions/checkout@master
130156 with :
131- repository : ${{ github.event. inputs.repository }}
132- ref : ${{ github.event. inputs.reference }}
157+ repository : ${{ inputs.repository }}
158+ ref : ${{ inputs.reference }}
133159 - run : make venv
134160 working-directory : ./Doc
135161 - run : sudo apt-get update && sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy librsvg2-bin
@@ -138,32 +164,37 @@ jobs:
138164 - uses : actions/upload-artifact@master
139165 if : always()
140166 with :
141- name : pdf-logs.zip
167+ name : python-${{ inputs.dist_version }}- pdf-logs.zip
142168 path : |
143169 ./Doc/build/latex/*.log
144170 ./Doc/build/latex/*.tex
145171 - uses : actions/upload-artifact@master
146172 if : always()
147173 with :
148- name : docs-pdf-a4.zip
149- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-pdf-a4.zip
174+ name : python-${{ inputs.dist_version }}- docs-pdf-a4.zip
175+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-pdf-a4.zip
150176 if-no-files-found : ignore
151177 - uses : actions/upload-artifact@master
152178 if : always()
153179 with :
154- name : docs-pdf-a4.tar.bz2
155- path : ./Doc/dist/python-${{ github.event. inputs.dist_version }}-docs-pdf-a4.tar.bz2
180+ name : python-${{ inputs.dist_version }}- docs-pdf-a4.tar.bz2
181+ path : ./Doc/dist/python-${{ inputs.dist_version }}* -docs-pdf-a4.tar.bz2
156182 if-no-files-found : ignore
157183 publish :
158184 needs : [build-html, build-text, build-texinfo, build-epub, build-pdf]
159- if : ${{ !cancelled() && github.event. inputs.publish == 'true' }}
185+ if : ${{ !cancelled() && inputs.publish == 'true' }}
160186 runs-on : ubuntu-latest
187+ concurrency :
188+ group : gh-pages-publish
189+ cancel-in-progress : false
161190 steps :
162191 - name : Checkout gh-pages branch
163- uses : actions/checkout@v4
192+ uses : actions/checkout@v5
164193 with :
165194 ref : gh-pages
166195 path : gh-pages
196+ - name : Pull latest gh-pages
197+ run : git -C gh-pages pull --rebase origin gh-pages
167198 - name : Download all artifacts
168199 uses : actions/download-artifact@master
169200 with :
@@ -172,32 +203,32 @@ jobs:
172203 run : |
173204 mkdir -p gh-pages/3
174205 # PDF
175- cp artifacts/docs-pdf-a4.zip/ python-${{ github.event. inputs.dist_version }}-docs-pdf-a4.zip gh-pages/3/ 2>/dev/null || true
176- cp artifacts/docs-pdf-a4.tar.bz2/ python-${{ github.event. inputs.dist_version }}-docs-pdf-a4.tar.bz2 gh-pages/3/ 2>/dev/null || true
206+ cp artifacts/python-${{ inputs.dist_version }}-docs-pdf-a4.zip/* gh-pages/3/ 2>/dev/null || true
207+ cp artifacts/python-${{ inputs.dist_version }}-docs-pdf-a4.tar.bz2/* gh-pages/3/ 2>/dev/null || true
177208 # HTML
178- cp artifacts/docs-html.zip/ python-${{ github.event. inputs.dist_version }}-docs-html.zip gh-pages/3/ 2>/dev/null || true
179- cp artifacts/docs-html.tar.bz2/ python-${{ github.event. inputs.dist_version }}-docs-html.tar.bz2 gh-pages/3/ 2>/dev/null || true
209+ cp artifacts/python-${{ inputs.dist_version }}-docs-html.zip/* gh-pages/3/ 2>/dev/null || true
210+ cp artifacts/python-${{ inputs.dist_version }}-docs-html.tar.bz2/* gh-pages/3/ 2>/dev/null || true
180211 # Text
181- cp artifacts/docs-text.zip/ python-${{ github.event. inputs.dist_version }}-docs-text.zip gh-pages/3/ 2>/dev/null || true
182- cp artifacts/docs-text.tar.bz2/ python-${{ github.event. inputs.dist_version }}-docs-text.tar.bz2 gh-pages/3/ 2>/dev/null || true
212+ cp artifacts/python-${{ inputs.dist_version }}-docs-text.zip/* gh-pages/3/ 2>/dev/null || true
213+ cp artifacts/python-${{ inputs.dist_version }}-docs-text.tar.bz2/* gh-pages/3/ 2>/dev/null || true
183214 # Texinfo
184- cp artifacts/docs-texinfo.zip/ python-${{ github.event. inputs.dist_version }}-docs-texinfo.zip gh-pages/3/ 2>/dev/null || true
185- cp artifacts/docs-texinfo.tar.bz2/ python-${{ github.event. inputs.dist_version }}-docs-texinfo.tar.bz2 gh-pages/3/ 2>/dev/null || true
215+ cp artifacts/python-${{ inputs.dist_version }}-docs-texinfo.zip/* gh-pages/3/ 2>/dev/null || true
216+ cp artifacts/python-${{ inputs.dist_version }}-docs-texinfo.tar.bz2/* gh-pages/3/ 2>/dev/null || true
186217 # EPUB
187- cp artifacts/docs.epub/ python-${{ github.event. inputs.dist_version }}-docs.epub gh-pages/3/ 2>/dev/null || true
218+ cp artifacts/python-${{ inputs.dist_version }}-docs.epub/* gh-pages/3/ 2>/dev/null || true
188219 - name : Commit generated archives
189220 id : commit
190221 run : |
191222 cd gh-pages
192223 git config user.name github-actions
193224 git config user.email github-actions@github.com
194- git add 3/python-${{ github.event.inputs.dist_version }}-docs-* || true
225+ git add 3/
195226 if git diff --cached --quiet; then
196227 echo "No documentation archives to commit"
197- echo "has_changes=false" >> $GITHUB_OUTPUT
228+ echo "has_changes=false" >> " $GITHUB_OUTPUT"
198229 else
199- git commit -m "Update documentation archives for ${{ github.event. inputs.dist_version }}"
200- echo "has_changes=true" >> $GITHUB_OUTPUT
230+ git commit -m "Update documentation archives for ${{ inputs.dist_version }}"
231+ echo "has_changes=true" >> " $GITHUB_OUTPUT"
201232 fi
202233 - name : Push commit
203234 if : steps.commit.outputs.has_changes == 'true'
0 commit comments