Repository navigation
Add a manual workflow that stages main for release on npm - #31
Merged
Merged
Conversation
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
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.
Adds
.github/workflows/publish.yml, run by hand from the Actions tab (Publish to npm → Run workflow onmain). It stages the package from main at the version inpackage.json. Nothing goes live until a maintainer approves it on npm with 2FA.What it does:
main, and stops if that version is already on npm.npm ci,npm run test,npm run test:wordpressandbuild-plugin.sh --check.npm stage publish, using npm trusted publishing (GitHub OIDC), so no npm token is stored.v<version>with generated notes, so there's no tag for a version that hasn't been approved.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 bundledphpneedslibxml2.so.2.Setup before the first run
On npmjs.com:
serverlesswp→ Settings → Trusted Publisher → GitHub Actionsmitchmacserverlesswp-nodepublish.ymlnpm 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
main.npm stage approve <stage-id>.v<version>from the Releases page.Testing
npm stage publish --dry-run --access publicaccepts the command and flags. It stops at login, as expected without credentials.npm pack --dry-runincludes onlysrc/,php-files/,wordpress-assets/andwordpress.js.🤖 Generated with Claude Code
https://claude.ai/code/session_01FkTtrKVDL3kpMPM3eAFY5X