Skip to content

Commit fb398e7

Browse files
committed
updated pypi-release.yml
Signed-off-by: Chin Yeung Li <tli@nexb.com>
1 parent 8051234 commit fb398e7

1 file changed

Lines changed: 37 additions & 19 deletions

File tree

.github/workflows/pypi-release.yml

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
1-
name: Release library as a PyPI wheel and sdist on GH release creation
1+
name: Build Python distributions and publish on PyPI
22

33
on:
4-
release:
5-
types: [created]
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*"
68

79
jobs:
8-
build-and-publish-to-pypi:
10+
build-and-publish:
911
name: Build and publish library to PyPI
1012
runs-on: ubuntu-24.04
13+
1114
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python
14-
uses: actions/setup-python@v5
15-
with:
16-
python-version: 3.9
17-
- name: Install pypa/build
18-
run: python -m pip install build --user
19-
- name: Build a binary wheel and a source tarball
20-
run: python -m build --sdist --wheel --outdir dist/
21-
.
22-
- name: Publish distribution to PyPI
23-
if: startsWith(github.ref, 'refs/tags')
24-
uses: pypa/gh-action-pypi-publish@master
25-
with:
26-
password: ${{ secrets.PYPI_API_TOKEN }}
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.9
21+
22+
- name: Install pypa/build
23+
run: python -m pip install build --user
24+
25+
- name: Build a binary wheel and a source tarball
26+
run: python -m build --sdist --wheel --outdir dist/ .
27+
28+
- name: Publish to PyPI
29+
if: startsWith(github.ref, 'refs/tags')
30+
uses: pypa/gh-action-pypi-publish@release/v1
31+
with:
32+
password: ${{ secrets.PYPI_API_TOKEN }}
33+
34+
- name: Upload built archives
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: pypi_archives
38+
path: dist/*
2739

40+
- name: Create a GitHub release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
generate_release_notes: true
44+
draft: false
45+
files: dist/*

0 commit comments

Comments
 (0)