Skip to content

Commit 6a8f3b6

Browse files
authored
Add Release Workflow (#2)
This adds a GitHub workflow to automatically release the project to PyPI, when triggering a GitHub release. It is based on PyPIs trusted publisher concept.
1 parent 87ac4b0 commit 6a8f3b6

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
X_PYTHON_MIN_VERSION: "3.11"
9+
10+
jobs:
11+
publish:
12+
name: Upload release to PyPI
13+
runs-on: ubuntu-latest
14+
environment: release
15+
permissions:
16+
# IMPORTANT: this permission is mandatory for trusted publishing
17+
id-token: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{env.X_PYTHON_MIN_VERSION }}
25+
- name: Install Python dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build
29+
- name: Create source and wheel dist
30+
# (2024-12-11, s-heppner)
31+
# The PyPI Action expects the dist files in a toplevel `/dist` directory,
32+
# so we have to specify this as output directory here.
33+
run: |
34+
python -m build --outdir dist
35+
- name: Publish distribution to PyPI
36+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)