Skip to content

Commit 340de42

Browse files
Copilotm-aciek
andauthored
Remove manual dist_version input and compute it automatically from CPython source
Agent-Logs-Url: https://github.com/m-aciek/python-docs-offline/sessions/ec73fdcb-6e24-46b9-8332-5110f124c25f Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com>
1 parent 9e36151 commit 340de42

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

.github/workflows/build.yaml

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
description: 'Commit reference from CPython repository'
77
required: true
88
default: '3.14'
9-
dist_version:
10-
description: 'Dist version (compatible with patchlevel.py output)'
11-
required: true
12-
default: '3.14'
139
repository:
1410
description: 'Repository to checkout'
1511
required: false
@@ -28,10 +24,6 @@ on:
2824
description: 'Commit reference from CPython repository'
2925
default: '3.14'
3026
type: string
31-
dist_version:
32-
description: 'Dist version (compatible with patchlevel.py output)'
33-
default: '3.14'
34-
type: string
3527
repository:
3628
description: 'Repository to checkout'
3729
default: 'python/cpython'
@@ -49,7 +41,23 @@ permissions:
4941
pages: write
5042
id-token: write
5143
jobs:
44+
prepare:
45+
runs-on: ubuntu-latest
46+
outputs:
47+
dist_version: ${{ steps.get-version.outputs.dist_version }}
48+
steps:
49+
- uses: actions/setup-python@master
50+
with:
51+
python-version: ${{ inputs.python_version }}
52+
- uses: actions/checkout@master
53+
with:
54+
repository: ${{ inputs.repository }}
55+
ref: ${{ inputs.reference }}
56+
- id: get-version
57+
run: echo "dist_version=$(python tools/extensions/patchlevel.py --short)" >> $GITHUB_OUTPUT
58+
working-directory: ./Doc
5259
build-html:
60+
needs: prepare
5361
runs-on: ubuntu-latest
5462
steps:
5563
- uses: actions/setup-python@master
@@ -66,16 +74,17 @@ jobs:
6674
- uses: actions/upload-artifact@master
6775
if: always()
6876
with:
69-
name: python-${{ inputs.dist_version }}-docs-html.zip
70-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-html.zip
77+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-html.zip
78+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-html.zip
7179
if-no-files-found: ignore
7280
- uses: actions/upload-artifact@master
7381
if: always()
7482
with:
75-
name: python-${{ inputs.dist_version }}-docs-html.tar.bz2
76-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-html.tar.bz2
83+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-html.tar.bz2
84+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-html.tar.bz2
7785
if-no-files-found: ignore
7886
build-text:
87+
needs: prepare
7988
runs-on: ubuntu-latest
8089
steps:
8190
- uses: actions/setup-python@master
@@ -92,16 +101,17 @@ jobs:
92101
- uses: actions/upload-artifact@master
93102
if: always()
94103
with:
95-
name: python-${{ inputs.dist_version }}-docs-text.zip
96-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-text.zip
104+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-text.zip
105+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-text.zip
97106
if-no-files-found: ignore
98107
- uses: actions/upload-artifact@master
99108
if: always()
100109
with:
101-
name: python-${{ inputs.dist_version }}-docs-text.tar.bz2
102-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-text.tar.bz2
110+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-text.tar.bz2
111+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-text.tar.bz2
103112
if-no-files-found: ignore
104113
build-texinfo:
114+
needs: prepare
105115
runs-on: ubuntu-latest
106116
steps:
107117
- uses: actions/setup-python@master
@@ -119,16 +129,17 @@ jobs:
119129
- uses: actions/upload-artifact@master
120130
if: always()
121131
with:
122-
name: python-${{ inputs.dist_version }}-docs-texinfo.zip
123-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-texinfo.zip
132+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-texinfo.zip
133+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-texinfo.zip
124134
if-no-files-found: ignore
125135
- uses: actions/upload-artifact@master
126136
if: always()
127137
with:
128-
name: python-${{ inputs.dist_version }}-docs-texinfo.tar.bz2
129-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-texinfo.tar.bz2
138+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-texinfo.tar.bz2
139+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-texinfo.tar.bz2
130140
if-no-files-found: ignore
131141
build-epub:
142+
needs: prepare
132143
runs-on: ubuntu-latest
133144
steps:
134145
- uses: actions/setup-python@master
@@ -145,10 +156,11 @@ jobs:
145156
- uses: actions/upload-artifact@master
146157
if: always()
147158
with:
148-
name: python-${{ inputs.dist_version }}-docs.epub
149-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs.epub
159+
name: python-${{ needs.prepare.outputs.dist_version }}-docs.epub
160+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs.epub
150161
if-no-files-found: ignore
151162
build-pdf:
163+
needs: prepare
152164
runs-on: ubuntu-latest
153165
steps:
154166
- uses: actions/setup-python@master
@@ -166,21 +178,21 @@ jobs:
166178
- uses: actions/upload-artifact@master
167179
if: always()
168180
with:
169-
name: python-${{ inputs.dist_version }}-pdf-logs.zip
181+
name: python-${{ needs.prepare.outputs.dist_version }}-pdf-logs.zip
170182
path: |
171183
./Doc/build/latex/*.log
172184
./Doc/build/latex/*.tex
173185
- uses: actions/upload-artifact@master
174186
if: always()
175187
with:
176-
name: python-${{ inputs.dist_version }}-docs-pdf-a4.zip
177-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-pdf-a4.zip
188+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-pdf-a4.zip
189+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-pdf-a4.zip
178190
if-no-files-found: ignore
179191
- uses: actions/upload-artifact@master
180192
if: always()
181193
with:
182-
name: python-${{ inputs.dist_version }}-docs-pdf-a4.tar.bz2
183-
path: ./Doc/dist/python-${{ inputs.dist_version }}*-docs-pdf-a4.tar.bz2
194+
name: python-${{ needs.prepare.outputs.dist_version }}-docs-pdf-a4.tar.bz2
195+
path: ./Doc/dist/python-${{ needs.prepare.outputs.dist_version }}*-docs-pdf-a4.tar.bz2
184196
if-no-files-found: ignore
185197
publish:
186198
needs: [build-html, build-text, build-texinfo, build-epub, build-pdf]

0 commit comments

Comments
 (0)