Skip to content

Commit 183a4c3

Browse files
committed
fix pypi publish workflwo to work with trusted publishing
1 parent 97cf5e7 commit 183a4c3

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
---
2-
name: Publish Python Package
2+
name: Publish Python 🐍 package to PyPI
33

44
on:
55
release:
6-
types: [created]
6+
types: [published]
7+
8+
permissions:
9+
id-token: write # REQUIRED for OIDC
10+
contents: read # required for checkout
711

812
jobs:
9-
build-n-publish:
10-
name: Build and publish Python 🐍 distributions 📦 to PyPI
13+
publish:
14+
name: Publish to PyPI
15+
environment: release # Must match the environment name in PyPI
1116
runs-on: ubuntu-latest
1217

1318
steps:
14-
- uses: actions/checkout@v3
19+
- name: Check out repository
20+
uses: actions/checkout@v4
1521

16-
- name: Install uv
17-
uses: astral-sh/setup-uv@v3
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
1824
with:
19-
enable-cache: true
25+
python-version: '3.x'
2026

21-
- name: Set up Python
22-
run: uv python install 3.10
27+
- name: Install build tools
28+
run: pip install build
2329

24-
- name: Build source and wheel archives
25-
run: uv build
30+
- name: Build package
31+
run: python -m build
2632

27-
- name: Publish distribution 📦 to PyPI
28-
uses: pypa/gh-action-pypi-publish@v1.2.2
29-
with:
30-
user: __token__
31-
password: ${{ secrets.PYPI_PASSWORD }}
33+
- name: Publish to PyPI via Trusted Publisher
34+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)