ci(pypi): add Trusted Publishing workflow#48
Closed
cdeust wants to merge 1 commit into
Closed
Conversation
The existing release.yml only builds a GitHub Release; PyPI uploads had to be done by-hand from a maintainer's shell, which means every release depends on a maintainer having local PyPI auth AND remembering to run twine. This is why v3.17.1 (security fix for GHSA-gvpp-v77h-5w8g) needed an interactive shell to ship even after the GHSA was published. This workflow uses PEP 740 Trusted Publishing — GitHub Actions mints an OIDC token, PyPI verifies it against the configured trusted publisher (owner=cdeust, repo=Cortex, workflow=publish-pypi.yml), and issues a one-shot upload token. No long-lived secret stored anywhere. Triggers: - push:tags:v* (every tag automatically publishes) - workflow_dispatch (manual re-publish for tags that pre-date this workflow, e.g. v3.17.1) Setup required on PyPI side (one-time, before the first run can publish): 1. Log in to pypi.org as a maintainer of neuro-cortex-memory. 2. Navigate to the project Publishing settings page. 3. Add a new GitHub publisher: Owner: cdeust Repository name: Cortex Workflow filename: publish-pypi.yml Environment name: (blank — or "pypi" if also set in the workflow's publish job, see comment) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded: instead of a new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
release.ymlonly builds a GitHub Release; PyPI uploads have always been by-hand from a maintainer's shell. v3.17.1 (the GHSA-gvpp-v77h-5w8g security fix) is sitting tagged + released on GitHub but unpublished on PyPI because the maintainer's PyPI token isn't visible to the Claude-Code subprocess shell that built it.What
A new workflow
.github/workflows/publish-pypi.ymlthat uses PEP 740 Trusted Publishing — GitHub Actions mints a short-lived OIDC token, PyPI verifies it against the trusted-publisher configuration on the project, and issues a one-shot upload token. No long-lived secret stored anywhere.Triggers:
push: tags: v*— every tag auto-publishesworkflow_dispatch— manual re-publish for tags that pre-date this workflow (i.e.v3.17.1)Setup required on PyPI side (one-time)
After this merges, do this once on pypi.org:
neuro-cortex-memory.cdeustCortexpublish-pypi.ymlpypiif you also uncomment theenvironment:line in the workflow's publish job)After PyPI is configured
I'll re-trigger this workflow against tag
v3.17.1viaworkflow_dispatchto actually ship the security fix. Subsequent tag pushes will auto-publish without any further action.Why now, instead of next release
The security fix for GHSA-gvpp-v77h-5w8g (CVSS 7.8 HIGH) is currently advertised in the published GHSA and GitHub Release but cannot be installed via
pip install --upgrade neuro-cortex-memory. Every hour that gap stays open is a maintainer-availability risk.🤖 Generated with Claude Code