Skip to content

Commit 3610923

Browse files
authored
Add GitHub Actions workflow for PyPI publishing
1 parent 3e43570 commit 3610923

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # e.g. v0.1.0, v1.2.3
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install build tools
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install build twine
25+
26+
- name: Build sdist and wheel
27+
run: python -m build
28+
29+
- name: Check distribution files
30+
run: twine check dist/*
31+
32+
- name: Publish to PyPI
33+
if: startsWith(github.ref, 'refs/tags/')
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
user: __token__
37+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)