ci: add OIDC PyPI publish workflow

Trusted-publishing workflow on release/workflow_dispatch, plus docs/PUBLISH.md.
This commit is contained in:
Yash Shah
2026-09-19 01:04:42 +05:30
parent c20fa9a25a
commit 6792fb37fc
2 changed files with 57 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build
run: |
pip install -q build
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
+30
View File
@@ -0,0 +1,30 @@
# Publishing to PyPI
API-token upload is currently blocked (old token 403). Prefer **Trusted Publishing** (OIDC).
## One-time setup (per package on pypi.org)
For each project (`duckcheck`, `embedsync`, `agentbox-sandbox`, `mcp-tool-evals`, `pytest-llm-vcr`):
1. PyPI → Project → Publishing → **Add a new pending publisher**
2. Owner: `yashshah9`
3. Repo: matching GitHub repo name
4. Workflow: `publish.yml`
5. Environment: `pypi`
Also create a GitHub Environment named `pypi` on each repo (Settings → Environments).
## Publish a release
```bash
gh release create vX.Y.Z --generate-notes
# or: Actions → "Publish to PyPI" → Run workflow
```
## Manual token upload (fallback)
```bash
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=pypi-... # fresh token
cd <repo> && python -m build && twine upload dist/*
```