Skip to content

Commit 041f5bb

Browse files
ci: switch PyPI publish workflow to Trusted Publishing
Replace the rye PYPI_TOKEN env with the pypa/gh-action-pypi-publish action and id-token: write permissions, so the workflow uploads via PyPI Trusted Publishing rather than a long-lived token. Other steps in publish-pypi.yml are unchanged. After merge, the PyPI project will need a Trusted Publisher binding pointing at openai/openai-python and the publish-pypi.yml workflow name. Closes #3273.
1 parent e757667 commit 041f5bb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
name: publish
1010
runs-on: ubuntu-latest
1111
environment: publish
12+
permissions:
13+
contents: read
14+
id-token: write
1215

1316
steps:
1417
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -19,8 +22,10 @@ jobs:
1922
version: '0.44.0'
2023
enable-cache: true
2124

22-
- name: Publish to PyPI
25+
- name: Build distributions
2326
run: |
24-
bash ./bin/publish-pypi
25-
env:
26-
PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
27+
mkdir -p dist
28+
rye build --clean
29+
30+
- name: Publish to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)