Skip to content

ci(pypi): add Trusted Publishing workflow#48

Closed
cdeust wants to merge 1 commit into
mainfrom
ci/pypi-trusted-publishing
Closed

ci(pypi): add Trusted Publishing workflow#48
cdeust wants to merge 1 commit into
mainfrom
ci/pypi-trusted-publishing

Conversation

@cdeust
Copy link
Copy Markdown
Owner

@cdeust cdeust commented May 27, 2026

Why

release.yml only 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.yml that 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-publishes
  • workflow_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:

  1. Log in to pypi.org as a maintainer of neuro-cortex-memory.
  2. Go to https://pypi.org/manage/project/neuro-cortex-memory/settings/publishing/
  3. Click Add a new publisher → GitHub.
  4. Fill in:
    • Owner: cdeust
    • Repository name: Cortex
    • Workflow filename: publish-pypi.yml
    • Environment name: leave blank (or pypi if you also uncomment the environment: line in the workflow's publish job)
  5. Save.

After PyPI is configured

I'll re-trigger this workflow against tag v3.17.1 via workflow_dispatch to 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

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>
@cdeust
Copy link
Copy Markdown
Owner Author

cdeust commented May 27, 2026

Superseded: instead of a new publish-pypi.yml (which would need a fresh PyPI Trusted Publisher entry), the build+publish-pypi jobs were restored directly into release.yml in 9c9b659. That reuses the existing trusted-publisher entry (cdeust/Cortex, release.yml, env=pypi) from the <=3.14.7 era, so no PyPI reconfiguration is needed, and it's wired as a non-blocking deprecated channel per ADR-0050. Closing this PR.

@cdeust cdeust closed this May 27, 2026
@cdeust cdeust deleted the ci/pypi-trusted-publishing branch May 27, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant