Skip to content

Commit 5617c24

Browse files
CI: Publish to PyPI on release
1 parent e32a16e commit 5617c24

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
release-build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup uv
18+
run: |
19+
chmod + x setup.sh
20+
./setup.sh
21+
22+
- name: Build release distributions
23+
run: |
24+
uv build
25+
26+
- name: Upload distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: release-dists
30+
path: dist/
31+
32+
pypi-publish:
33+
runs-on: ubuntu-latest
34+
needs:
35+
- release-build
36+
permissions:
37+
# IMPORTANT: this permission is mandatory for trusted publishing
38+
id-token: write
39+
40+
# Dedicated environments with protections for publishing are strongly recommended.
41+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
42+
environment:
43+
name: pypi
44+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
45+
# url: https://pypi.org/p/YOURPROJECT
46+
#
47+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
48+
# ALTERNATIVE: exactly, uncomment the following line instead:
49+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
50+
51+
steps:
52+
- name: Retrieve release distributions
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: release-dists
56+
path: dist/
57+
58+
- name: Publish release distributions to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
packages-dir: dist/

0 commit comments

Comments
 (0)