Skip to content

Commit 4d81ae7

Browse files
committed
Add GitHub action to publish to PyPI on tagging a release
Signed-off-by: Thomas Druez <tdruez@nexb.com>
1 parent 9de844f commit 4d81ae7

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/pypi-release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build Python distributions and publish on PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
jobs:
10+
build-and-publish:
11+
name: Build and publish library to PyPI
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
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 }}

0 commit comments

Comments
 (0)