Skip to content

Commit cb319e0

Browse files
Merge pull request #888 from IBM/romeokienzler-patch-5
Add GitHub Actions workflow for PyPI publishing
2 parents 2716a89 + 674818c commit cb319e0

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: Build and publish Python package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # publish only on tag pushes like v1.2.3
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # necessary for setuptools_scm to see tags
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.10"
21+
22+
- name: Install build & twine
23+
run: python -m pip install --upgrade pip build twine setuptools_scm
24+
25+
- name: Build sdist and wheel
26+
run: python -m build --sdist --wheel
27+
28+
- name: Check artifacts
29+
run: ls -l dist
30+
31+
- name: Publish to PyPI
32+
env:
33+
TWINE_USERNAME: __token__
34+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
35+
run: |
36+
python -m twine check dist/*
37+
python -m twine upload dist/* --non-interactive

0 commit comments

Comments
 (0)