Skip to content

Commit 8972c7c

Browse files
committed
fix python release
1 parent 51030ed commit 8972c7c

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
name: Release Python to PyPI
1616
runs-on: ubuntu-latest
1717
if: startsWith(github.ref, 'refs/tags/py-')
18+
permissions:
19+
id-token: write # Required for trusted publishing
20+
contents: read
1821
steps:
1922
- uses: actions/checkout@v4
2023

@@ -26,20 +29,17 @@ jobs:
2629
- name: Install build dependencies
2730
run: |
2831
python -m pip install --upgrade pip
29-
pip install build twine
32+
pip install build
3033
3134
- name: Build Python package
3235
run: |
3336
cd python-api
3437
python -m build
3538
3639
- name: Publish to PyPI
37-
env:
38-
TWINE_USERNAME: __token__
39-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
40-
run: |
41-
cd python-api
42-
python -m twine upload dist/*
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
with:
42+
packages-dir: python-api/dist/
4343

4444
release-nodejs:
4545
name: Release Node.js to npm

RELEASE.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,24 @@ Use the `release.sh` script to easily release any component.
3030

3131
## Prerequisites
3232

33-
Before you can create releases, you need to set up the following secrets in your GitHub repository:
33+
Before you can create releases, you need to configure the following:
3434

35-
### 1. PyPI Token (for Python releases)
35+
### 1. PyPI Trusted Publishing (for Python releases)
3636

37-
1. Go to https://pypi.org/manage/account/token/
38-
2. Create a new API token with upload permissions
39-
3. In your GitHub repository, go to Settings > Secrets and variables > Actions
40-
4. Create a new secret named `PYPI_API_TOKEN` and paste the token
37+
PyPI uses **Trusted Publishing** (OIDC), which requires no tokens or passwords:
38+
39+
1. Go to https://pypi.org/manage/account/publishing/ (or create the project first via manual upload)
40+
2. Add a new "pending publisher" for your package:
41+
- **PyPI Project Name**: `vectorize-iris`
42+
- **Owner**: Your GitHub username or org (e.g., `vectorize-io`)
43+
- **Repository name**: `vectorize-iris`
44+
- **Workflow name**: `release.yml`
45+
- **Environment name**: (leave blank)
46+
3. Save the publisher
47+
48+
**Note**: If the package doesn't exist on PyPI yet, you'll need to do a one-time manual upload first, then configure Trusted Publishing in the project settings.
49+
50+
For more info: https://docs.pypi.org/trusted-publishers/
4151

4252
### 2. npm Token (for Node.js releases)
4353

@@ -169,9 +179,11 @@ If the automated workflow fails, you can manually release individual components:
169179
# Update version in python-api/pyproject.toml first
170180
cd python-api
171181
python -m build
182+
183+
# Manual upload (requires PyPI credentials)
172184
python -m twine upload dist/*
173185

174-
# Create and push tag
186+
# Or just create and push the tag to trigger automated release
175187
git tag py-0.1.0
176188
git push origin py-0.1.0
177189
```

0 commit comments

Comments
 (0)