Skip to content

ci(npm): publish @wailsio/runtime via Trusted Publishing (OIDC) - #5646

Merged
leaanthony merged 2 commits into
masterfrom
worktree-ci-npm-trusted-publishing
Jun 22, 2026
Merged

leaanthony merged 2 commits into
masterfrom
worktree-ci-npm-trusted-publishing

Conversation

@taliesin-ai

@taliesin-ai taliesin-ai commented Jun 22, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

publish-npm.yml has failed at the Publish npm package step on every run since ~Feb 2026. The earlier steps (build → bump → commit → push) succeed, so master's runtime version climbed to alpha.90 while npm stayed frozen at alpha.79 (last good publish 2026-01-25).

The failure is npm E404 on PUT https://registry.npmjs.org/@wailsio%2fruntime — npm's disguised authorization failure (404 not 403 to avoid leaking package existence). I.e. secrets.NPM_TOKEN is no longer authorized to publish the @wailsio scope.

Impact: alpha.79 predates the Android runtime bridge (window.wails.invokeAsync), so JS↔Go bindings are broken for every stock wails3 init Android app — the runtime falls back to fetch('/wails/runtime'), whose POST body the Android WebView drops → HTTP 422 missing object value.

Fix

Migrate to npm Trusted Publishing (OIDC) — no long-lived token to rot:

  • add id-token: write for the OIDC token + automatic provenance
  • upgrade npm to ≥ 11.5.1 (required for trusted publishing)
  • replace JS-DevTools/npm-publish + NPM_TOKEN with plain npm publish --access public

Required out-of-band step (done)

A Trusted Publisher is configured for @wailsio/runtime on npmjs.com: org wailsapp, repo wails, workflow publish-npm.yml, empty environment.

Effect

One successful run ships alpha.91 (master already has the bridge); templates pin "latest", so all stock Android users are fixed.

Validated with actionlint (clean) + YAML parse. End-to-end publish only testable in CI after merge.

Summary by CodeRabbit

  • Chores
    • Updated the npm package publishing workflow to use GitHub Trusted Publishing for enhanced security and reliability.

The publish-npm workflow has failed at the npm publish step on every run
since ~Feb 2026 (npm E404 on PUT = NPM_TOKEN not authorized for the
@wailsio scope), so master's runtime version climbed to alpha.90 while npm
stayed frozen at alpha.79 — which lacks the Android runtime bridge and
breaks JS<->Go bindings for every stock 'wails3 init' Android app.

Switch to npm Trusted Publishing (OIDC):
- add id-token: write for the OIDC token + provenance
- upgrade npm to >= 11.5.1 (required for trusted publishing)
- replace JS-DevTools/npm-publish + NPM_TOKEN with plain 'npm publish'

Requires a Trusted Publisher configured for @wailsio/runtime on npmjs.com
(repo wailsapp/wails, workflow publish-npm.yml).
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The publish-npm.yml workflow migrates the @wailsio/runtime npm package publication from token-based auth (NPM_TOKEN via JS-DevTools/npm-publish) to GitHub OIDC Trusted Publishing. The job gains id-token: write, a new step upgrades npm to a version compatible with Trusted Publishing, and the publish step becomes a direct npm publish --access public command.

Changes

npm Publish OIDC Migration

Layer / File(s) Summary
OIDC permission, npm upgrade, and publish step replacement
.github/workflows/publish-npm.yml
id-token: write is added to the job permissions; a new step installs a Trusted Publishing-compatible npm version and prints it; the JS-DevTools/npm-publish action with secrets.NPM_TOKEN is replaced by a direct npm publish --access public run from the runtime package directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐇 Hop hop, the token's gone away,
OIDC leaps into the fray!
With id-token: write in paw,
npm trusts without a flaw.
The bunny publishes with glee — no secrets, just identity! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is comprehensive and addresses the core template requirements. It explains the problem, root cause, impact, and solution. However, it does not follow the structured template format with explicit checkboxes for type of change, testing details, and verification checklist. Add explicit sections for 'Type of change', 'How Has This Been Tested', and the required checklist items from the template to meet repository standards.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating npm publishing to Trusted Publishing via OIDC. It is specific, on-topic, and reflects the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-ci-npm-trusted-publishing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony
leaanthony merged commit cc06cf4 into master Jun 22, 2026
12 of 13 checks passed
@leaanthony
leaanthony deleted the worktree-ci-npm-trusted-publishing branch June 22, 2026 09:42
leaanthony added a commit that referenced this pull request Jun 28, 2026
…auto-commit sponsor image (#5647)

* ci(npm): publish prerelease as latest + bump CI Node to 22

The OIDC migration (#5646) authenticates correctly but `npm publish` fails
on npm >= 11 with 'You must specify a tag using --tag when publishing a
prerelease version' — the old JS-DevTools action defaulted to `latest`
implicitly. v3 intentionally ships alpha.N as the default dist-tag (the
templates pin "@wailsio/runtime": "latest"), so publish with --tag latest.

Also bump the CI Node from the deprecated 20 to 22 (LTS).

* ci(npm): verify generated artifacts + commit regenerated runtime to master

Harden the publish flow per the existing regenerate-before-publish design:
- add a Verify step that fails the job if (re)generation didn't produce the
  expected outputs (bundled runtime + npm dist/), catching silent build
  failures before anything is published or committed.
- make the commit-back explicit: 'git add -A' sweeps every regenerated tracked
  file (bundled runtime in internal/assetserver/bundledassets, generated
  pkg/events/events.go, TypeDoc output) back to master alongside the version
  bump; log 'git status' so the committed set is visible. dist/ is gitignored
  and is rebuilt fresh by prepack at publish time.

* ci(sponsors): auto-commit sponsor image instead of opening a PR

Push the regenerated website/static/img/sponsors.svg straight to master
(no-op when unchanged) using the bypass-capable WAILS_REPO_TOKEN, matching
publish-npm.yml, rather than opening a daily 'update sponsors' PR. Also
modernise the actions (checkout v3->v4, setup-node v2->v4, Node 20->22).

---------

Co-authored-by: Lea Anthony <[email protected]>
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