@@ -30,17 +30,18 @@ jobs:
3030 - name : Install build dependency
3131 run : python3 -m pip install --constraint requirements/build.txt build
3232
33- - name : Build binary wheel and source tarball
34- run : PIP_CONSTRAINT=requirements/build.txt python3 -m build --sdist --wheel --outdir dist/ .
33+ - name : Build binary wheel, source tarball and changelog
34+ run : |
35+ PIP_CONSTRAINT=requirements/build.txt python3 -m build --sdist --wheel --outdir dist/ .
36+ awk "/## $GITHUB_REF_NAME/{flag=1; next} /## v/{flag=0} flag" docs/CHANGELOG.md > changelog
3537
3638 - name : Store build artifacts
3739 uses : actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
38- # NOTE: The GitHub release page contains the release artifacts too, but using
39- # GitHub upload/download actions seems robuster: there is no need to compute
40- # download URLs and tampering with artifacts between jobs is more limited.
4140 with :
4241 name : build-artifacts
43- path : dist
42+ path : |
43+ dist
44+ changelog
4445
4546 candidate_release :
4647 name : Release candidate on Github for review
5556 uses : actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
5657 with :
5758 name : build-artifacts
58- path : dist
5959
6060 - id : gh-release
6161 name : Publish GitHub release draft
6868 repo: context.repo.repo,
6969 name: '${{ github.ref_name }}-rc',
7070 tag_name: '${{ github.ref }}',
71- body: 'Release waiting for review...' ,
71+ body: fs.readFileSync('changelog', 'utf8') ,
7272 });
7373
7474 fs.readdirSync('dist/').forEach(file => {
9595 uses : actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
9696 with :
9797 name : build-artifacts
98- path : dist
9998
10099 - name : Publish binary wheel and source tarball on PyPI
101100 # Only attempt pypi upload in upstream repository
@@ -111,7 +110,4 @@ jobs:
111110 repo: context.repo.repo,
112111 release_id: '${{ needs.candidate_release.outputs.release_id }}',
113112 name: '${{ github.ref_name }}',
114- body: 'See [CHANGELOG.md](https://github.com/' +
115- context.repo.owner + '/' + context.repo.repo +
116- '/blob/${{ github.ref_name }}/docs/CHANGELOG.md) for details.'
117113 })
0 commit comments