Skip to content

Add a manual workflow that stages main for release on npm - #31

Merged
mitchmac merged 2 commits into
mainfrom
ccr-d52f2103-rpghuc
Nov 20, 2026
Merged

mitchmac merged 2 commits into
mainfrom
ccr-d52f2103-rpghuc

Conversation

@mitchmac

@mitchmac mitchmac commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Adds .github/workflows/publish.yml, run by hand from the Actions tab (Publish to npm → Run workflow on main). It stages the package from main at the version in package.json. Nothing goes live until a maintainer approves it on npm with 2FA.

What it does:

  • Runs only from main, and stops if that version is already on npm.
  • Runs npm ci, npm run test, npm run test:wordpress and build-plugin.sh --check.
  • Stages the version with npm stage publish, using npm trusted publishing (GitHub OIDC), so no npm token is stored.
  • Creates a draft GitHub release v<version> with generated notes, so there's no tag for a version that hasn't been approved.
  • Puts the approval steps in the run summary.

Node 22 comes with npm 10, so the workflow installs npm 11 (staged publishing needs 11.15.0 or later). It runs on ubuntu-24.04, like the Jest workflow, because the bundled php needs libxml2.so.2.

Setup before the first run

On npmjs.com: serverlesswp → Settings → Trusted Publisher → GitHub Actions

  • Organization or user: mitchmac
  • Repository: serverlesswp-node
  • Workflow filename: publish.yml
  • Environment: leave blank
  • Leave Allow npm publish unchecked, so the workflow can only stage

npm says a new trusted publisher config expires if its first successful publish doesn't happen within 2 days. If that happens, re-add it before running.

Releasing

  1. Run the workflow on main.
  2. Approve the staged version in the package's Staged Packages tab on npmjs.com (2FA required), or with npm stage approve <stage-id>.
  3. Publish the draft release v<version> from the Releases page.

Testing

  • The workflow hasn't run yet. GitHub only offers manual workflows once they're on the default branch, so the first run happens after merge.
  • With npm 11.21.3, npm stage publish --dry-run --access public accepts the command and flags. It stops at login, as expected without credentials.
  • npm pack --dry-run includes only src/, php-files/, wordpress-assets/ and wordpress.js.
  • The YAML parses.
  • npm's docs don't say whether a staged version gets a provenance attestation once approved. The first release will show it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FkTtrKVDL3kpMPM3eAFY5X

Run from the Actions tab. It refuses to run off main or to republish a
version that is already on npm, runs the Jest, WordPress and stream
wrapper checks, publishes with npm trusted publishing (no stored token,
provenance attached) and creates a GitHub release tagged v<version>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkTtrKVDL3kpMPM3eAFY5X
The trusted publisher is set up stage-only, so the workflow now runs
npm stage publish and a maintainer approves the version with 2FA before
it goes live. The GitHub release is created as a draft, so there is no
tag for a version that has not been approved, and the run summary lists
the approval steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkTtrKVDL3kpMPM3eAFY5X
@mitchmac mitchmac changed the title Add a manual workflow that publishes main to npm Add a manual workflow that stages main for release on npm Nov 20, 2026
@mitchmac
mitchmac merged commit cfa819f into main Nov 20, 2026
4 checks passed
@mitchmac
mitchmac deleted the ccr-d52f2103-rpghuc branch November 20, 2026 03:14
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.

2 participants