Skip to content

Update npm release workflow with OIDC authentication and OOM fixes - #2419

Merged
findolor merged 4 commits into
mainfrom
fix/wasm-linker-oom
Jan 28, 2026
Merged

Update npm release workflow with OIDC authentication and OOM fixes#2419
findolor merged 4 commits into
mainfrom
fix/wasm-linker-oom

Conversation

@findolor

@findolor findolor commented Jan 27, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The npm release workflow was failing due to WASM linker OOM errors and using an older token-based npm authentication approach. This update modernizes the workflow to use OIDC-based npm authentication (more secure, no token needed) and adds resource management to prevent OOM failures.

Solution

  • Nix installer: Replace nixbuild/nix-quick-install-action with DeterminateSystems/nix-installer-action + flakehub-cache-action
  • Node.js: Upgrade from v22 to v24.x with registry-url configured for OIDC
  • OIDC authentication: Add npm upgrade for OIDC support, OIDC verification step, and repository verification step
  • npm publish: Replace JS-DevTools/npm-publish action with native npm publish using OIDC (no NPM_TOKEN needed)
  • Publish order: Move commit/tag steps to after npm publish (safer - only commits if publish succeeds)
  • OOM fixes: Add free disk space step and 8GB swap space to prevent WASM linker OOM
  • Error handling: Add fallback for Get Old Hash step when packages don't exist yet
  • Dist tag: Add --tag latest to ensure alpha-versioned packages get the latest tag

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Chores
    • Improved release reliability with OIDC token validation and repository URL verification before publishing.
    • Optimized CI performance via better disk/swap management, caching, and intermediate artifact cleanup.
    • Streamlined multi-package publishing: consolidated build/test phases, standardized tarball packaging, and more verbose publish reporting.
    • Upgraded Node.js build environment to 24.x and added npm provenance/upgrade checks.

✏️ Tip: You can customize this high-level summary in your review settings.

The WASM test step has been failing since November 2025 with:
error: linking with `rust-lld` failed: signal: 7 (SIGBUS)

This is caused by the linker running out of memory on the
ubuntu-latest runner (~7GB RAM). This commit:

- Adds jlumbroso/free-disk-space to free ~30GB (Android, .NET, etc.)
- Adds 8GB swap space for the WASM linking phase

Also adds workflow_dispatch trigger for manual testing.
All publish steps are skipped during workflow_dispatch runs.
- Replace nixbuild/nix-quick-install-action with DeterminateSystems nix-installer
- Upgrade Node.js to 24.x with registry-url for OIDC
- Add npm upgrade, OIDC verification, and repository verification steps
- Replace JS-DevTools/npm-publish action with native npm publish
- Move commit/tag steps after npm publish (safer on failure)
- Add --tag latest to ensure alpha versions get latest dist-tag
- Add free disk space and swap space steps
- Add error handling to Get Old Hash step
@findolor findolor self-assigned this Jan 27, 2026
@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Refactors the npm package release GitHub Actions workflow: replaces installers/caches, upgrades Node.js, adds OIDC and repository checks, reworks WASM/UI build/test/artifact steps, changes version/hash-based gating, replaces external publish action with inline npm publish, and consolidates tarball/tag/release logic.

Changes

Cohort / File(s) Summary
GitHub Actions release workflow
.github/workflows/npm-package-release.yml
Comprehensive rewrite of the npm-package-release pipeline: swapped installer/cache steps (free-disk-space, nix-installer, determinate/flakehub), added 8G swap and artifact cleanup, upgraded Node.js to 24.x and configured npm registry, added OIDC id-token verification and repository URL consistency checks, reworked WASM and UI build/test phases with intermediate artifact removal, changed versioning to compute OLD_HASH/NEW_HASH and set NEW_VERSION, replaced external publish action with inline npm publish for orderbook and ui-components, standardized tarball creation/renaming (OB_NPM_PACKAGE/UC_NPM_PACKAGE), and added conditional commit/tag/push on hash changes plus unified GitHub Release creation.

Sequence Diagram(s)

sequenceDiagram
participant GH as GitHub Actions
participant OIDC as OIDC Provider
participant NPM as npm Registry
participant Git as Git Remote
participant GHRelease as GitHub Releases

GH->>OIDC: request id-token (id-token: write)
OIDC-->>GH: id-token
GH->>NPM: configure registry + authenticate (using id-token / npm token)
GH->>GH: run build/test (WASM, UI components) with swap & cleanup
GH->>GH: compute OLD_HASH / NEW_HASH, set NEW_VERSION
alt hashes differ
  GH->>GH: create tarballs (orderbook, ui-components)
  GH->>NPM: npm publish tarballs (inline npm publish)
  GH->>Git: commit, tag, push (using GITHUB_TOKEN)
  GH->>GHRelease: create release and upload tarballs
else no changes
  GH-->>GH: skip publish/commit/tag
end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • fix npm release issue #2288 — Modifies the same .github/workflows/npm-package-release.yml, overlapping checkout/build preparation and installer/cache changes.
  • use npm ci #2140 — Adds npm-blacklist and related npm/workspace CI checks to the release workflow.
  • minor fix for publish workflow #1480 — Adjusts release conditions and how orderbook/ui-components versions and tags are handled in the workflow.

Suggested reviewers

  • hardyjosh
  • 0xgleb
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: updating the npm release workflow with OIDC authentication and addressing OOM issues through resource management (disk space/swap).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

@findolor
findolor requested review from 0xgleb and hardyjosh January 27, 2026 13:34
Restore removed comments and add new ones to document:
- Job condition preventing infinite loops
- Nix/Node setup for OIDC publishing
- Disk space and swap management for WASM builds
- Hash comparison logic for publish skipping
- Package tarball creation and publishing steps

@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

🤖 Fix all issues with AI agents
In @.github/workflows/npm-package-release.yml:
- Around line 206-213: The publish step named "Publish ui-components To NPM" is
missing authentication and provenance flags; update the npm publish invocation
to export/use NODE_AUTH_TOKEN in the step environment (add NODE_AUTH_TOKEN: ${{
secrets.NPM_TOKEN }} to the job/step env) and append the --provenance flag to
the npm publish command (the line invoking npm publish
ui_components_npm_package_${{ env.NEW_VERSION }}.tgz should include
--provenance), leaving the existing --access, --tag and --verbose flags intact;
ensure the step still runs under the same if condition (if: ${{ env.OLD_HASH !=
env.NEW_HASH }}).
- Around line 225-232: Remove the unnecessary GITHUB_TOKEN env from the "Push
Changes To Remote" step and rely on the SSH key configured during checkout;
update the git push commands to be explicit about what to push (e.g., git push
origin <branch-name> and git push -u origin npm-v${{ env.NEW_VERSION }} or push
the tag/branch explicitly) so the step "Push Changes To Remote" uses SSH auth
and clearly specifies the target branch/tag instead of depending on the token.

Comment on lines 206 to +213
# publish ui-components to npm
- name: Publish ui-components To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: ui_components_npm_package_${{ env.NEW_VERSION }}.tgz
run: |
npm publish ui_components_npm_package_${{ env.NEW_VERSION }}.tgz \
--access public \
--tag latest \
--verbose

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.

⚠️ Potential issue | 🔴 Critical

Same authentication issue as orderbook publish.

Apply the same fix here: add NODE_AUTH_TOKEN environment variable and --provenance flag.

🐛 Proposed fix
       - name: Publish ui-components To NPM
         if: ${{ env.OLD_HASH != env.NEW_HASH }}
         run: |
           npm publish ui_components_npm_package_${{ env.NEW_VERSION }}.tgz \
             --access public \
             --tag latest \
+            --provenance \
             --verbose
+        env:
+          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# publish ui-components to npm
- name: Publish ui-components To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: ui_components_npm_package_${{ env.NEW_VERSION }}.tgz
run: |
npm publish ui_components_npm_package_${{ env.NEW_VERSION }}.tgz \
--access public \
--tag latest \
--verbose
# publish ui-components to npm
- name: Publish ui-components To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
npm publish ui_components_npm_package_${{ env.NEW_VERSION }}.tgz \
--access public \
--tag latest \
--provenance \
--verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
🤖 Prompt for AI Agents
In @.github/workflows/npm-package-release.yml around lines 206 - 213, The
publish step named "Publish ui-components To NPM" is missing authentication and
provenance flags; update the npm publish invocation to export/use
NODE_AUTH_TOKEN in the step environment (add NODE_AUTH_TOKEN: ${{
secrets.NPM_TOKEN }} to the job/step env) and append the --provenance flag to
the npm publish command (the line invoking npm publish
ui_components_npm_package_${{ env.NEW_VERSION }}.tgz should include
--provenance), leaving the existing --access, --tag and --verbose flags intact;
ensure the step still runs under the same if condition (if: ${{ env.OLD_HASH !=
env.NEW_HASH }}).

Comment on lines +225 to +232
# Push the commit to remote
- name: Push Changes To Remote
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git push origin
git push -u origin npm-v${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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 | 🔵 Trivial

Potentially redundant GITHUB_TOKEN for push.

The checkout step (line 30-32) uses ssh-key for authentication. Git push should automatically use the SSH key configured during checkout, making the GITHUB_TOKEN environment variable unnecessary here.

Additionally, consider being explicit about the branch to push:

♻️ Suggested simplification
       - name: Push Changes To Remote
         if: ${{ env.OLD_HASH != env.NEW_HASH }}
         run: |
-          git push origin
+          git push origin HEAD:main
           git push -u origin npm-v${{ env.NEW_VERSION }}
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
🤖 Prompt for AI Agents
In @.github/workflows/npm-package-release.yml around lines 225 - 232, Remove the
unnecessary GITHUB_TOKEN env from the "Push Changes To Remote" step and rely on
the SSH key configured during checkout; update the git push commands to be
explicit about what to push (e.g., git push origin <branch-name> and git push -u
origin npm-v${{ env.NEW_VERSION }} or push the tag/branch explicitly) so the
step "Push Changes To Remote" uses SSH auth and clearly specifies the target
branch/tag instead of depending on the token.

@findolor
findolor merged commit 12cd20a into main Jan 28, 2026
18 checks passed
@findolor findolor added this to the v5 final prs milestone Jan 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai

coderabbitai Bot commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

The author of this PR is on the CodeRabbit Free Plan. In order to use the Chat feature, please upgrade the PR author to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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.

3 participants