From 6792fb37fcaae227e00c38363b8fe75dbd070700 Mon Sep 17 00:00:00 2001 From: Yash Shah Date: Sat, 19 Sep 2026 01:04:42 +0530 Subject: [PATCH] ci: add OIDC PyPI publish workflow Trusted-publishing workflow on release/workflow_dispatch, plus docs/PUBLISH.md. --- .github/workflows/publish.yml | 27 +++++++++++++++++++++++++++ docs/PUBLISH.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 docs/PUBLISH.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fd9bf3e --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 + diff --git a/docs/PUBLISH.md b/docs/PUBLISH.md new file mode 100644 index 0000000..9328ab8 --- /dev/null +++ b/docs/PUBLISH.md @@ -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 && python -m build && twine upload dist/* +```