Skip to content

ci: fix runtime publish (tag/Node), commit regenerated runtime back, auto-commit sponsor image - #5647

Merged
leaanthony merged 4 commits into
masterfrom
ci-npm-publish-tag-and-node
Jun 28, 2026
Merged

leaanthony merged 4 commits into
masterfrom
ci-npm-publish-tag-and-node

Conversation

@taliesin-ai

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

Copy link
Copy Markdown
Collaborator

Follow-up to #5646 (npm Trusted Publishing / OIDC). Three CI fixes:

1. Publish prerelease as latest + Node 22

The OIDC migration authenticates correctly, but the first run failed at npm publish:

npm error You must specify a tag using --tag when publishing a prerelease version.

npm ≥ 11 won't implicitly tag a prerelease (-alpha.N) as latest; the old JS-DevTools/npm-publish action did. v3 intentionally ships alpha.N as the default dist-tag (templates pin "@wailsio/runtime": "latest"), so publish with --tag latest. Also bumps CI Node 20→22 (clears the runner deprecation warning).

A dispatched run with this fix already published @wailsio/[email protected] (npm latest, SLSA provenance) — verified the tarball contains the Android runtime bridge. This PR makes the fix durable on master.

2. Verify generated artifacts + commit the regenerated runtime back

task runtime:build regenerates tracked, non-npm files — the bundled desktop runtime (internal/assetserver/bundledassets/runtime.js + .debug.js) and pkg/events/events.go — which must stay in sync with the published package.

  • New Verify step fails the publish if (re)generation didn't produce the expected outputs (bundled runtime + npm dist/), catching silent build failures before publish/commit.
  • The commit step now git add -A + logs git status, so every regenerated tracked file is committed back to master alongside the version bump (dist/ is gitignored and rebuilt by prepack at publish).

3. Sponsor image: auto-commit instead of PR

generate-sponsor-image.yml opened a daily update sponsors PR. It now pushes sponsors.svg directly to master (no-op when unchanged) via the bypass-capable WAILS_REPO_TOKEN, same pattern as publish-npm.yml. Actions modernised (checkout v3→v4, setup-node v2→v4, Node 20→22).

Validated with actionlint (clean).

Summary by CodeRabbit

  • Chores
    • Updated build infrastructure to use Node.js 22
    • Enhanced npm package publishing with artifact verification
    • Refined prerelease package distribution tagging

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).
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Two CI workflows receive modernization updates: the sponsor-image generation workflow now uses Node.js 22, explicit repository token checkout, and direct commit-to-branch instead of pull-request creation. The npm publish workflow also upgrades to Node.js 22, adds artifact verification to catch missing generated files, improves git staging with git add -A, and explicitly publishes releases under the latest dist-tag via --tag latest.

Changes

Sponsor Image Generation Workflow

Layer / File(s) Summary
Permissions and token-based checkout
.github/workflows/generate-sponsor-image.yml
Adds explicit contents: write permissions, updates checkout to use secrets.WAILS_REPO_TOKEN || github.token for authenticated access, and upgrades actions/setup-node to v4 with Node.js 22.
Direct commit workflow instead of pull request
.github/workflows/generate-sponsor-image.yml
Replaces pull-request creation with a conditional check for file changes; commits updated website/static/img/sponsors.svg directly to the default branch with [skip ci] message and pushes the commit.

npm Publish Workflow Updates

Layer / File(s) Summary
Node.js upgrade and artifact verification
.github/workflows/publish-npm.yml
Node.js setup upgraded to version 22. New artifact verification step checks that expected runtime output files are present and non-empty; workflow exits with error if any required file is missing.
Version commit and explicit dist-tag publication
.github/workflows/publish-npm.yml
Git staging command changed from git add . to git add -A to ensure regenerated files are included in the version bump commit. npm publish command updated to include --tag latest for explicit latest dist-tag assignment instead of relying on npm's default prerelease tag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • wailsapp/wails#4101: Modifies the same publish-npm.yml workflow's version-bump and regenerated-artifact commit behavior.

Suggested reviewers

  • leaanthony

Poem

🐇 Node twenty-two hops in with grace,
Two workflows modernized, keeping pace!
Sponsors commit straight, no PR delay—
Publish tags latest the proper way.
This bunny approves the workflow update,
CI smooth sailing—simply astute! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides detailed technical context and rationale for the changes, but does not follow the required template structure with issue links, type of change checkbox, testing details, or completion checklist. Add issue reference (Fixes #XXXX), select type of change checkbox, document testing performed, and complete the PR template checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the three main changes: npm publish tag fix, Node version update, regenerated runtime commit handling, and sponsor image auto-commit.
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 ci-npm-publish-tag-and-node

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/publish-npm.yml (1)

81-84: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider pinning the action to a commit hash for supply chain security.

Static analysis flags this action as unpinned. While GitHub's official actions are generally trusted, pinning to a hash would align with the approach used for step-security/changed-files elsewhere in this workflow and mitigate potential tag-hijacking risks.

You can find the commit hash for v4 from the releases page.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-npm.yml around lines 81 - 84, The setup-node
action in the workflow file is currently referenced using a version tag v4,
which is a mutable reference vulnerable to tag hijacking. Replace the version
tag with a specific commit hash by changing the uses field from
actions/setup-node@v4 to actions/setup-node@ followed by the full commit hash
for v4 (obtainable from the GitHub releases page for the actions/setup-node
repository). This pins the action to an immutable commit reference, aligning
with security best practices already applied to other actions in the workflow.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/publish-npm.yml:
- Around line 81-84: The setup-node action in the workflow file is currently
referenced using a version tag v4, which is a mutable reference vulnerable to
tag hijacking. Replace the version tag with a specific commit hash by changing
the uses field from actions/setup-node@v4 to actions/setup-node@ followed by the
full commit hash for v4 (obtainable from the GitHub releases page for the
actions/setup-node repository). This pins the action to an immutable commit
reference, aligning with security best practices already applied to other
actions in the workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8175124f-b83b-4e80-9e54-3dfe58563163

📥 Commits

Reviewing files that changed from the base of the PR and between f1f3031 and acb0e17.

📒 Files selected for processing (1)
  • .github/workflows/publish-npm.yml

…aster

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.
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).
@taliesin-ai taliesin-ai changed the title ci(npm): publish prerelease as latest + bump CI Node to 22 ci: fix runtime publish (tag/Node), commit regenerated runtime back, auto-commit sponsor image Jun 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/generate-sponsor-image.yml:
- Line 16: The workflow uses mutable version tags (`@v4`) for the actions/checkout
and actions/setup-node actions, which creates a security vulnerability. Replace
the mutable `@v4` tags with immutable commit SHA references: update
actions/checkout@v4 to actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
and update actions/setup-node to
actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020. This pins the
workflow to specific commit hashes rather than allowing the action version to
change unexpectedly.
- Around line 13-20: The high-privilege WAILS_REPO_TOKEN is being passed to the
actions/checkout@v4 step where it persists as a credential for the entire
workflow, increasing exposure risk. In the checkout step, add
persist-credentials: false to disable credential persistence and remove the
token override to use the default read-only github.token instead. Move the
WAILS_REPO_TOKEN to only the git push operation in a subsequent step where it is
actually needed for pushing to the protected branch. Before using the bypass
token in the push operation, add a validation check to ensure WAILS_REPO_TOKEN
is available, and only pass it to the specific git command that requires
elevated permissions rather than making it available globally throughout the
workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 442a9977-b102-4985-85e8-3dc00508b9b4

📥 Commits

Reviewing files that changed from the base of the PR and between acb0e17 and 1f0f453.

📒 Files selected for processing (2)
  • .github/workflows/generate-sponsor-image.yml
  • .github/workflows/publish-npm.yml

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