Skip to content

CLI: publish @recoupable/cli to npm on every merge via trusted publishing #2365

Open

Description

@sweetmanrecoup

Tracking issue for making every merge to recoupable/cli main publish @recoupable/cli to npm automatically, without anyone's personal npm login. Status 2026-10-27: fixed. Merges to main publish via npm trusted publishing; 0.1.19 (with cli#26–28) is live with provenance. Remaining: revoke the old token on npm, and Sid's Owner role later. Before the fix, publishing had been broken since 2026-10-13. npm had stayed on 0.1.15 (published 2026-06-25) while main reached 0.1.18, so three merged PRs never shipped (cli#26, cli#27, cli#28). Raised on the 2026-10-26 Sid + Sweets call (notes): Sid's agent couldn't publish CLI changes because the package sits under Sweets' personal npm account.

Goal

  • A merge to recoupable/cli main publishes the new version to npm with no human step and no long-lived NPM_TOKEN secret (npm trusted publishing from GitHub Actions via OIDC).
  • The changes already on main (cli#26–28) are live on npm.
  • A failed publish no longer leaves a version bump on main that never reached npm.
  • Sid's account can administer the package without going through Sweets (Owner on the recoupable npm org).

PRs (updated 2026-10-27)

PR Item State
npm settings (no PR) Add a trusted publisher on @recoupable/cli for recoupable/cli → publish.yml ✅ configured 2026-10-26; validated by the 0.1.19 publish — see Done
cli#29 publish.yml on OIDC trusted publishing (drop NPM_TOKEN); bump only after a successful publish; add repository to package.json ✅ merged 2026-10-27 — see Done
npm org (no PR) Make Sid an Owner on the recoupable npm org ⏳ deferred until Sid moves to a recoupable.com address

All publishing work is merged and live; what remains is cleanup and the deferred Owner role.

Done

  • Configure npm trusted publishing for @recoupable/cli. ✅ 2026-10-26: package settings list recoupable/cli / publish.yml (label "publish on merge to main"; npm publish, stage publish and dist-tag allowed). npm showed "Pending validation" (deadline 2026-10-29 02:35 UTC) until the 0.1.19 publish on 2026-10-27; npm settings now show Status: Valid (confirmed by Sweets 2026-10-27).

  • cli#29 — publish from main via OIDC; bump only after publish. ✅ Shipped 2026-10-27 (squash-merged to main as d575029; bump commit a8bccbc).
    publish.yml now has id-token: write, Node 24 and npm ^11.5.1, and runs npm publish with no NPM_TOKEN. The version bump starts from the higher of npm's latest and package.json, so a rerun never republishes (this addressed the CodeRabbit finding). The bump is committed and pushed only after the publish succeeds. package.json has repository.
    Verified: publish run 40439687934 passed every step. Its log shows + @recoupable/cli@0.1.19 and "Signed provenance statement … from GitHub Actions" (sigstore 3502545448). The registry reports latest: 0.1.19 with bin.recoup = dist/bin.cjs. npx @recoupable/cli@0.1.19 --version prints 0.1.19, and songs analyze with no prompt fails locally before sending a request (the cli#26 behaviour). The bump commit landed after the publish step. npm's "pending validation" on the trusted publisher is cleared by this first publish.

  • Deleted the NPM_TOKEN secret from recoupable/cli. ✅ 2026-10-27, after confirming no workflow references it. gh secret list --repo recoupable/cli now returns 0 secrets.

Open — next up

  • Revoke the old npm token (owner). The NPM_TOKEN repo secret was deleted 2026-10-27 (see Done); the token itself may still exist on npmjs.com → Access Tokens.
    • Done when: no token for this package appears under Sweets' npm Access Tokens, and the next merge to cli still publishes.

Open — later

  • Sid as Owner on the recoupable npm org.
    • Status: 2026-10-26: Sweets invited sydney@syncstream.ai as a developer, and Sid accepted. npm's invite form offered only the developer role.
    • Fix: once Sid's npm account moves to a recoupable.com address, promote it to Owner on the recoupable org (npm org set recoupable <sid-username> owner, or the org's Members page).
    • Done when: npm org ls recoupable shows Sid as owner.
    • With trusted publishing in place, Sid's agent doesn't need npm credentials to ship: merging to main is enough. Owner is for administering the package (settings, maintainers, deprecations).

Architecture decisions

  • Publish on merge, not by hand. Every merge to main ships a patch release. Anyone who can merge to recoupable/cli can release, and no npm credential is involved.
  • OIDC trusted publishing over a stored token. Nothing to rotate or leak, and publishing no longer depends on one person's account. Each release gets npm provenance tying the tarball to the exact workflow run.

Source references

Activity

  1. changed the title [-]CLI: publish @recoupable/cli to npm on every merge via trusted publishing (publishing broken since 2026-10-13)[/-] [+]CLI: publish @recoupable/cli to npm on every merge via trusted publishing[/+] on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions