Skip to content

Commit 9155d41

Browse files
committed
Modernize and simplify the "publish release" GitHub action
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent d206f09 commit 9155d41

File tree

1 file changed

+10
-37
lines changed

1 file changed

+10
-37
lines changed

.github/workflows/pypi-release.yml

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ name: Create library release archives, create a GH release and publish PyPI whee
77
# - upload wheels and sdist to PyPI
88
# - create gh-release and upload wheels and dists there
99
# TODO: smoke test wheels and sdist
10-
# TODO: add changelog to release text body
1110

1211
# WARNING: this is designed only for packages building as pure Python wheels
1312

@@ -18,7 +17,7 @@ on:
1817
- "v*.*.*"
1918

2019
jobs:
21-
build-pypi-distribs:
20+
build-and-publish:
2221
name: Build and publish library to PyPI
2322
runs-on: ubuntu-22.04
2423

@@ -28,54 +27,28 @@ jobs:
2827
- name: Set up Python
2928
uses: actions/setup-python@v5
3029
with:
31-
python-version: 3.11
30+
python-version: 3.12
3231

3332
- name: Install pypa/build
3433
run: python -m pip install build --user
3534

3635
- name: Build a binary wheel and a source tarball
37-
run: python -m build --sdist --wheel --outdir dist/
36+
run: python -m build --sdist --wheel --outdir dist/ .
3837

3938
- name: Upload built archives
40-
uses: actions/upload-artifact@v3
39+
uses: actions/upload-artifact@v4
4140
with:
4241
name: pypi_archives
4342
path: dist/*
4443

45-
create-gh-release:
46-
name: Create GH release
47-
needs:
48-
- build-pypi-distribs
49-
runs-on: ubuntu-22.04
50-
51-
steps:
52-
- name: Download built archives
53-
uses: actions/download-artifact@v4.1.7
44+
- name: Publish to PyPI
45+
uses: pypa/gh-action-pypi-publish@release/v1
5446
with:
55-
name: pypi_archives
56-
path: dist
47+
password: ${{ secrets.PYPI_API_TOKEN }}
5748

58-
- name: Create GH release
59-
uses: softprops/action-gh-release@v1
49+
- name: Create a GitHub release entry
50+
uses: softprops/action-gh-release@v2
6051
with:
52+
generate_release_notes: true
6153
draft: false
6254
files: dist/*
63-
64-
create-pypi-release:
65-
name: Create PyPI release
66-
needs:
67-
- create-gh-release
68-
runs-on: ubuntu-22.04
69-
70-
steps:
71-
- name: Download built archives
72-
uses: actions/download-artifact@v4.1.7
73-
with:
74-
name: pypi_archives
75-
path: dist
76-
77-
- name: Publish to PyPI
78-
if: startsWith(github.ref, 'refs/tags')
79-
uses: pypa/gh-action-pypi-publish@master
80-
with:
81-
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)