ci(publish-libraries): fix NODE_AUTH_TOKEN workaround for PowerShell#1829
Conversation
The OIDC workaround from #1636 used bash-style inline env assignment (`NODE_AUTH_TOKEN="" npm publish`), but the step runs under pwsh, which parses `NODE_AUTH_TOKEN=` as a command name -> CommandNotFoundException. Set the env var the PowerShell way instead. This path was never exercised until web-recorder@0.1.0 (the first new package version since #1636), so the latent bug only surfaced now.
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
Pull request overview
Fixes the npm publish PowerShell script used by the CI “publish libraries” workflow by replacing a bash-style inline environment assignment with PowerShell-compatible syntax, ensuring the npm publish command actually runs under shell: pwsh.
Changes:
- Replace
NODE_AUTH_TOKEN="" npm publish ...(bash syntax) with PowerShell’s$env:NODE_AUTH_TOKEN = ""followed bynpm publish .... - Update the inline comment to explain the OIDC/trusted-publishing workaround intent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| Write-Host "Publishing..." | ||
| NODE_AUTH_TOKEN="" npm publish "$Tarball" "--access=$Access" # NODE_AUTH_TOKEN is a workaround for https://github.com/actions/setup-node/issues/1440 | ||
| # Reset NODE_AUTH_TOKEN to empty is a workaround for https://github.com/actions/setup-node/issues/1440 (OIDC trusted publishing) |
5f9e395
into
master
Problem
The npm publish step in
publish-libraries.ymlfailed on its first real publish (run #27769512117) with:Root cause
The OIDC trusted-publishing workaround introduced in #1636 used bash-style inline env assignment:
But this step runs under
shell: pwsh. PowerShell parsesNODE_AUTH_TOKEN=""as a command name, can't find it, and throws a (terminating)CommandNotFoundException—npm publishis never reached.This branch in
npm-publish.ps1only executes when a package has a new version to publish. Since #1636 merged (Dec 2025), every scheduled run hit only the "skip — version unchanged" path, so the buggy line was never exercised.@devolutions/web-recorder@0.1.0is the first genuinely-new package version since then, which is why the latent bug surfaced now.Fix
Set the env var the PowerShell way, preserving the OIDC workaround intent (empty
NODE_AUTH_TOKENso npm uses OIDC trusted publishing instead of a token):Validation
Reproduced locally in pwsh 7.6.3:
CommandNotFoundExceptionmessage as CI.NODE_AUTH_TOKENto empty string as intended.Note / follow-up
This fixes the script-syntax blocker only. A separate open question remains: whether npm OIDC trusted publishing is configured for the brand-new
@devolutions/web-recorderpackage on npmjs.org (trusted publishing typically requires the package/publisher to be pre-configured). That may need an ops check or a one-time token bootstrap for the first publish — out of scope for this PR.