Skip to content

Commit b034a91

Browse files
Add GitHub Actions workflow to publish package to PyPI
1 parent 3b9994e commit b034a91

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [created] # Trigger only when a release is created
6+
workflow_dispatch: # Allows manual triggering of the workflow
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Step 1: Check out the code
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
# Step 2: Set up Python
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.13
22+
23+
# Step 3: Install dependencies for building and publishing
24+
- name: Install build tools
25+
run: |
26+
pip install --upgrade pip
27+
pip install build twine
28+
29+
# Step 4: Build the package
30+
- name: Build the package
31+
run: |
32+
python -m build
33+
34+
# Step 5: Publish to PyPI
35+
- name: Publish to PyPI
36+
env:
37+
TWINE_USERNAME: __token__
38+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
39+
run: |
40+
python -m twine check dist/*
41+
python -m twine upload --skip-existing dist/*

0 commit comments

Comments
 (0)