Skip to content

Commit 1f7ebce

Browse files
committed
ci: Add pypi.yaml to automate publishing to PyPI
+ Adds `.github/workflows.pypi.yaml` to automate publishing of commits tagged with `v*` to PyPI. + Need to build locally and publish manually to setup account first and generate a token for the `[email protected]` account.
1 parent 94485e3 commit 1f7ebce

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/pypi.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish package to PyPi
2+
# See https://docs.pypi.org/trusted-publishers/adding-a-publisher/
3+
4+
on:
5+
push:
6+
tags:
7+
- v*
8+
workflow_dispatch: # Uncomment line if you also want to trigger action manually
9+
10+
jobs:
11+
build-release:
12+
runs-on: ubuntu-latest
13+
environment: pypi-publish
14+
name: Publish package to PyPi
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.9
23+
- name: Installing the package
24+
run: |
25+
pip3 install .
26+
pip3 install .[pypi]
27+
- name: Build package
28+
run: |
29+
pip3 install --upgrade setuptools
30+
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
31+
python -m build --no-isolation
32+
- name: Publish package to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1
34+
with:
35+
user: __token__
36+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)