@@ -35,20 +35,52 @@ jobs:
3535 with :
3636 attest-build-provenance-github : ' true'
3737
38- deploy :
39- if : github.repository == 'pytest-dev/pytest'
38+ generate-gh-release-notes :
4039 needs : [package]
4140 runs-on : ubuntu-latest
42- environment : deploy
4341 timeout-minutes : 30
4442 permissions :
45- id-token : write
46- contents : write
43+ contents : read
4744 steps :
4845 - uses : actions/checkout@v5
4946 with :
50- persist-credentials : true
47+ fetch-depth : 0
48+ persist-credentials : false
49+
50+ - name : Set up Python
51+ uses : actions/setup-python@v6
52+ with :
53+ python-version : " 3.13"
54+
55+ - name : Install tox
56+ run : |
57+ python -m pip install --upgrade pip
58+ pip install --upgrade tox
5159
60+ - name : Generate release notes
61+ env :
62+ VERSION : ${{ github.event.inputs.version }}
63+ run : |
64+ tox -e generate-gh-release-notes -- "$VERSION" gh-release-notes.md
65+
66+ - name : Upload release notes
67+ uses : actions/upload-artifact@v4
68+ with :
69+ name : release-notes
70+ path : gh-release-notes.md
71+ retention-days : 1
72+
73+ publish-to-pypi :
74+ if : github.repository == 'pytest-dev/pytest'
75+ # Need generate-gh-release-notes only for ordering.
76+ # Don't want to release to PyPI if generating GitHub release notes fails.
77+ needs : [package, generate-gh-release-notes]
78+ runs-on : ubuntu-latest
79+ environment : deploy
80+ timeout-minutes : 30
81+ permissions :
82+ id-token : write
83+ steps :
5284 - name : Download Package
5385 uses : actions/download-artifact@v6
5486 with :
6092 with :
6193 attestations : true
6294
95+ push-tag :
96+ needs : [publish-to-pypi]
97+ runs-on : ubuntu-latest
98+ timeout-minutes : 10
99+ permissions :
100+ contents : write
101+ steps :
102+ - uses : actions/checkout@v5
103+ with :
104+ fetch-depth : 0
105+ persist-credentials : true
106+
63107 - name : Push tag
64108 env :
65109 VERSION : ${{ github.event.inputs.version }}
@@ -69,48 +113,28 @@ jobs:
69113 git tag --annotate --message=v"$VERSION" "$VERSION" ${{ github.sha }}
70114 git push origin "$VERSION"
71115
72- release-notes :
73-
74- # todo: generate the content in the build job
75- # the goal being of using a github action script to push the release data
76- # after success instead of creating a complete python/tox env
77- needs : [deploy]
116+ create-github-release :
117+ needs : [push-tag, generate-gh-release-notes]
78118 runs-on : ubuntu-latest
79- timeout-minutes : 30
119+ timeout-minutes : 10
80120 permissions :
81121 contents : write
82122 steps :
83- - uses : actions/checkout@v5
84- with :
85- fetch-depth : 0
86- persist-credentials : false
87-
88123 - name : Download Package
89124 uses : actions/download-artifact@v6
90125 with :
91126 name : Packages
92127 path : dist
93128
94- - name : Set up Python
95- uses : actions/setup-python @v6
129+ - name : Download release notes
130+ uses : actions/download-artifact @v6
96131 with :
97- python-version : " 3.11"
98-
99- - name : Install tox
100- run : |
101- python -m pip install --upgrade pip
102- pip install --upgrade tox
103-
104- - name : Generate release notes
105- env :
106- VERSION : ${{ github.event.inputs.version }}
107- run : |
108- sudo apt-get install pandoc
109- tox -e generate-gh-release-notes -- "$VERSION" scripts/latest-release-notes.md
132+ name : release-notes
133+ path : .
110134
111135 - name : Publish GitHub Release
112136 env :
113137 VERSION : ${{ github.event.inputs.version }}
114138 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
115139 run : |
116- gh release create --notes-file scripts/latest -release-notes.md --verify-tag "$VERSION" dist/*
140+ gh release create --notes-file gh -release-notes.md --verify-tag "$VERSION" dist/*
0 commit comments