Skip to content

Commit 54cb98b

Browse files
committed
Add pypi publishing workflow
1 parent 4bf6c18 commit 54cb98b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build/publish Python Package
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
python -m pip install build twine
20+
- name: Build package
21+
run: |
22+
python -m build --sdist --wheel
23+
- name: Check package
24+
run: |
25+
python -m twine check dist/*
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish-to-pypi:
33+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34+
needs:
35+
- build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
steps:
42+
- name: Download distribution packages
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: python-package-distributions
46+
path: dist/
47+
- name: Publish to PyPI
48+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)