1- run-name : build ${{ github.event.inputs.tag }}
1+ run-name : build ${{ github.event.inputs.reference }}
22on :
33 workflow_dispatch :
44 inputs :
5- tag :
6- description : ' Tag from CPython repository'
5+ reference :
6+ description : ' Commit reference from CPython repository'
77 required : true
8- default : ' v3.14.0'
9- skip-tag-check :
10- description : ' Allow running build for non-latest patch tags (useful for testing)'
11- required : true
12- type : boolean
13- default : false
8+ default : ' 3.14'
149permissions :
1510 contents : write
1611jobs :
1712 build :
1813 runs-on : ubuntu-latest
1914 steps :
20- - name : Ensure input tag is latest patch for its major.minor
21- run : |
22- input_tag="${{ github.event.inputs.tag }}"
23- major_minor=$(echo "$input_tag" | grep -oE '^v[0-9]+\.[0-9]+')
24- latest_patch=$(git ls-remote --tags https://github.com/python/cpython.git | \
25- awk '{print $2}' | grep -E "refs/tags/${major_minor}\\.([0-9]+([abrc][0-9]+)?)$" | \
26- sed 's|refs/tags/||' | sed -E 's/([0-9]+)$/\1z0/' | sort -V | sed -E 's/z0$//' | tail -n1)
27- if [ "$input_tag" != "$latest_patch" ]; then
28- echo "Provided tag $input_tag is not the latest patch for $major_minor (latest: $latest_patch)." >&2
29- exit 1
30- fi
31- if : ${{ github.event.inputs.skip-tag-check == false }}
3215 - uses : actions/setup-python@master
3316 with :
3417 python-version : 3
3518 - uses : actions/checkout@master
3619 with :
3720 repository : python/cpython
38- ref : ${{ github.event.inputs.tag }}
21+ ref : ${{ github.event.inputs.reference }}
3922 - run : make venv
4023 working-directory : ./Doc
4124 - run : sudo apt-get update
@@ -60,98 +43,85 @@ jobs:
6043 id : build-pdf
6144 working-directory : ./Doc
6245 continue-on-error : true
63- - name : Strip leading v from tag
64- id : tag-no-v
65- run : |
66- echo "tag_no_v=${GITHUB_EVENT_INPUTS_TAG#v}" >> $GITHUB_OUTPUT
67- env :
68- GITHUB_EVENT_INPUTS_TAG : ${{ github.event.inputs.tag }}
6946 - uses : actions/upload-artifact@master
7047 with :
71- name : ${{ github.event.inputs.tag }}-docs-pdf-a4.zip
72- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-pdf-a4.zip
48+ name : ${{ github.event.inputs.reference }}-docs-pdf-a4.zip
49+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip
7350 if-no-files-found : ignore
7451 - uses : actions/upload-artifact@master
7552 with :
76- name : ${{ github.event.inputs.tag }}-docs-pdf-a4.tar.bz2
77- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-pdf-a4.tar.bz2
53+ name : ${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2
54+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2
7855 if-no-files-found : ignore
7956 - uses : actions/upload-artifact@master
8057 with :
81- name : ${{ github.event.inputs.tag }}-docs-html.zip
82- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-html.zip
58+ name : ${{ github.event.inputs.reference }}-docs-html.zip
59+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.zip
8360 if-no-files-found : ignore
8461 - uses : actions/upload-artifact@master
8562 with :
86- name : ${{ github.event.inputs.tag }}-docs-html.tar.bz2
87- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-html.tar.bz2
63+ name : ${{ github.event.inputs.reference }}-docs-html.tar.bz2
64+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2
8865 if-no-files-found : ignore
8966 - uses : actions/upload-artifact@master
9067 with :
91- name : ${{ github.event.inputs.tag }}-docs-text.zip
92- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-text.zip
68+ name : ${{ github.event.inputs.reference }}-docs-text.zip
69+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.zip
9370 if-no-files-found : ignore
9471 - uses : actions/upload-artifact@master
9572 with :
96- name : ${{ github.event.inputs.tag }}-docs-text.tar.bz2
97- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-text.tar.bz2
73+ name : ${{ github.event.inputs.reference }}-docs-text.tar.bz2
74+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2
9875 if-no-files-found : ignore
9976 - uses : actions/upload-artifact@master
10077 with :
101- name : ${{ github.event.inputs.tag }}-docs-texinfo.zip
102- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-texinfo.zip
78+ name : ${{ github.event.inputs.reference }}-docs-texinfo.zip
79+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.zip
10380 if-no-files-found : ignore
10481 - uses : actions/upload-artifact@master
10582 with :
106- name : ${{ github.event.inputs.tag }}-docs-texinfo.tar.bz2
107- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-texinfo.tar.bz2
83+ name : ${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2
84+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2
10885 if-no-files-found : ignore
10986 - uses : actions/upload-artifact@master
11087 with :
111- name : ${{ github.event.inputs.tag }}-docs.epub
112- path : ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs.epub
88+ name : ${{ github.event.inputs.reference }}-docs.epub
89+ path : ./Doc/dist/python-${{ github.event.inputs.reference }}-docs.epub
11390 if-no-files-found : ignore
11491 - name : Checkout gh-pages branch
11592 uses : actions/checkout@v4
11693 with :
11794 ref : gh-pages
11895 path : gh-pages
119- - name : Set major_minor variable
120- id : majorminor
121- run : |
122- input_tag="${{ github.event.inputs.tag }}"
123- major_minor=$(echo "$input_tag" | grep -oE '^[vV]([0-9]+\.[0-9]+)')
124- major_minor=${major_minor#v}
125- echo "major_minor=$major_minor" >> $GITHUB_OUTPUT
12696 - name : Copy generated archives to gh-pages
12797 run : |
12898 mkdir -p gh-pages/3
12999 # PDF
130- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-pdf-a4.zip gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-pdf-a4.zip 2>/dev/null || true
131- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-pdf-a4.tar.bz2 gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-pdf-a4.tar.bz2 2>/dev/null || true
100+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip 2>/dev/null || true
101+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2 2>/dev/null || true
132102 # HTML
133- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-html.zip gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-html.zip 2>/dev/null || true
134- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-html.tar.bz2 gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-html.tar.bz2 2>/dev/null || true
103+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-html.zip 2>/dev/null || true
104+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2 2>/dev/null || true
135105 # Text
136- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-text.zip gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-text.zip 2>/dev/null || true
137- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-text.tar.bz2 gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-text.tar.bz2 2>/dev/null || true
106+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-text.zip 2>/dev/null || true
107+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2 2>/dev/null || true
138108 # Texinfo
139- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-texinfo.zip gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-texinfo.zip 2>/dev/null || true
140- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs-texinfo.tar.bz2 gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs-texinfo.tar.bz2 2>/dev/null || true
109+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-texinfo.zip 2>/dev/null || true
110+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2 2>/dev/null || true
141111 # EPUB
142- cp ./Doc/dist/python-${{ steps.tag-no-v.outputs.tag_no_v }}-docs.epub gh-pages/3/python-${{ steps.majorminor.outputs.major_minor }}-docs.epub 2>/dev/null || true
112+ cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs.epub gh-pages/3/python-${{ github.event.inputs.reference }}-docs.epub 2>/dev/null || true
143113 - name : Commit generated archives
144114 id : commit
145115 run : |
146116 cd gh-pages
147117 git config user.name github-actions
148118 git config user.email github-actions@github.com
149- git add 3/python-${{ steps.majorminor.outputs.major_minor }}-docs-* || true
119+ git add 3/python-${{ github.event.inputs.reference }}-docs-* || true
150120 if git diff --cached --quiet; then
151121 echo "No documentation archives to commit"
152122 echo "has_changes=false" >> $GITHUB_OUTPUT
153123 else
154- git commit -m "Update documentation archives for ${{ steps.majorminor.outputs.major_minor }}"
124+ git commit -m "Update documentation archives for ${{ github.event.inputs.reference }}"
155125 echo "has_changes=true" >> $GITHUB_OUTPUT
156126 fi
157127 - name : Push commit
0 commit comments