Skip to content

chore(ci): publish to PyPI with Trusted Publishing / OIDC (GC1-104) - #281

Open
pmichalina-groq wants to merge 1 commit into
mainfrom
pmichalina/gc1-104-pypi-oidc-publishing
Open

chore(ci): publish to PyPI with Trusted Publishing / OIDC (GC1-104)#281
pmichalina-groq wants to merge 1 commit into
mainfrom
pmichalina/gc1-104-pypi-oidc-publishing

Conversation

@pmichalina-groq

@pmichalina-groq pmichalina-groq commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Part of GC1-104.

What

Replace token-based PyPI publishing with Trusted Publishing (GitHub OIDC):

  • publish-pypi workflow now builds with rye and uploads with pypa/gh-action-pypi-publish (pinned to the v1.14.2 commit). The job gets id-token: write and no longer reads PYPI_TOKEN / GROQ_PYPI_TOKEN.
  • PyPI generates PEP 740 attestations for the uploaded files automatically, so every release is signed (Sigstore) and shows verified provenance on pypi.org. Current releases (1.6.0 and earlier) have no provenance.
  • release-doctor and bin/check-release-environment no longer require the token secret.
  • bin/publish-pypi stays unchanged as a manual, token-based escape hatch (see CONTRIBUTING.md).
  • pyproject.toml gains Documentation and Changelog project URLs. With Trusted Publishing active, PyPI also marks the GitHub URLs as verified.

DO NOT MERGE until PyPI is configured

The groq project on PyPI must have a Trusted Publisher configured before this merges, or the next release will fail to publish. An owner of https://pypi.org/project/groq/ must:

  1. Open https://pypi.org/manage/project/groq/settings/publishing/
  2. Add a GitHub publisher with exactly:
    • Owner: groq
    • Repository: groq-python
    • Workflow name: publish-pypi.yml
    • Environment: leave blank
  3. After the first successful OIDC publish, delete the GROQ_PYPI_TOKEN / PYPI_TOKEN GitHub secrets and revoke the PyPI API token.

Verification

  • rye build --clean succeeds; sdist PKG-INFO shows the new project URLs and Author-email: Groq <[email protected]>
  • uvx yamllint on both workflows: no errors (only pre-existing line-length warnings)
  • bash -n bin/check-release-environment passes
  • After the first release under this workflow, https://pypi.org/project/groq/#files should show provenance/attestations per file

Note on Stainless

These workflow files are Stainless-generated templates. If a future codegen run conflicts with this change, the publishing config should be moved into the Stainless project config so the generator emits the OIDC workflow.

Companion PR: #280 updates the dependency lock files. The two PRs are independent; that one can merge first.

Replace token-based publishing with PyPI Trusted Publishing:

- publish-pypi workflow builds with rye, then uploads with
  pypa/gh-action-pypi-publish (pinned to v1.14.2). The job gets
  id-token: write and no longer reads a PYPI_TOKEN secret.
- PyPI generates PEP 740 attestations for the uploaded files
  automatically, so releases are signed and show verified
  provenance on pypi.org.
- release-doctor no longer requires the token secret;
  bin/check-release-environment drops the check.
- bin/publish-pypi stays as a manual, token-based escape hatch.
- pyproject.toml adds Documentation and Changelog project URLs.

The 'groq' project on PyPI must have a Trusted Publisher
configured for this repository and workflow BEFORE this change
merges, or the next release will fail to publish.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant