Skip to content

Commit ae603e1

Browse files
committed
Add GitHub Actions workflow to publish package to PyPI
1 parent aaacb4d commit ae603e1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Python Package to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Trigger on version tags like v1.0.0
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
build-and-publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.12
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.12'
21+
22+
- name: Upgrade pip
23+
run: python -m pip install --upgrade pip
24+
25+
- name: Install build tools
26+
run: pip install build twine
27+
28+
- name: Build the package
29+
run: python -m build
30+
31+
- name: Publish package to PyPI
32+
env:
33+
TWINE_USERNAME: __token__
34+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
35+
run: twine upload dist/* --non-interactive --skip-existing

0 commit comments

Comments
 (0)