Skip to content

Commit b124f5d

Browse files
committed
ci: add PyPI release workflow
1 parent d062268 commit b124f5d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-pypi:
9+
runs-on: ubuntu-latest
10+
environment: pypi
11+
permissions:
12+
id-token: write # required for trusted publishing (OIDC)
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Set version from tag
23+
run: |
24+
VERSION="${GITHUB_REF_NAME#v}"
25+
sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
26+
27+
- name: Install build tools
28+
run: pip install build
29+
30+
- name: Build package
31+
run: python -m build
32+
33+
- name: Publish to PyPI (trusted publishing)
34+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)