1111 build :
1212 name : Build
1313 runs-on : ubuntu-latest
14+ outputs :
15+ release_id : ${{ steps.gh-release.outputs.id }}
1416 steps :
1517 - name : Checkout release tag
1618 uses : actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
@@ -26,14 +28,29 @@ jobs:
2628 - name : Build binary wheel and source tarball
2729 run : python3 -m build --sdist --wheel --outdir dist/ .
2830
29- - name : Store build artifacts for review and release
31+ - id : gh-release
32+ name : Publish GitHub release candiate
33+ uses : softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
34+ with :
35+ name : ${{ github.ref_name }}-rc
36+ tag_name : ${{ github.ref }}
37+ body : " Release waiting for review..."
38+ files : dist/*
39+
40+ - name : Store build artifacts
41+ # NOTE: The release job could download the assets from the GitHub release page,
42+ # published in the previous step. But using the GitHub upload/download actions
43+ # seems more robust as there is no need to compute download URLs.
44+ # NOTE: (2) action-gh-release returns download URLSs as output, which could be
45+ # propagated to next job along with release_id (see above)
46+ # https://github.com/softprops/action-gh-release#outputs
3047 uses : actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
3148 with :
3249 name : build-artifacts
3350 path : dist
3451
35- release-on-pypi :
36- name : Release on PyPI
52+ release :
53+ name : Release
3754 runs-on : ubuntu-latest
3855 needs : build
3956 environment : release
4966 with :
5067 user : __token__
5168 password : ${{ secrets.PYPI_API_TOKEN }}
69+
70+ - name : Finalize GitHub release
71+ uses : actions/github-script@9ac08808f993958e9de277fe43a64532a609130e
72+ with :
73+ script : |
74+ await github.rest.repos.updateRelease({
75+ owner: context.repo.owner,
76+ repo: context.repo.repo,
77+ release_id: '${{ needs.build.outputs.release_id }}',
78+ name: '${{ github.ref_name }}',
79+ body: 'See [CHANGELOG.md](https://github.com/'+ context.repo.owner +'/'+ context.repo.repo +'/blob/${{ github.ref_name }}/docs/CHANGELOG.md) for details.'
80+ })
0 commit comments