ci(release): fix the workspace reify that breaks trusted publishing - #445
Merged
Conversation
@semantic-release/npm runs `npm version` with --userconfig pointed at a temp file. Under trusted publishing that file is never written, because the plugin returns from verify-auth before it reaches set-npmrc-auth, so --userconfig displaces ~/.npmrc and workspaces-update falls back to its default of true. `npm version` then reifies the workspace against the "*" ranges that multi-semantic-release has just rewritten to the versions this run intends to publish, and dies with ETARGET on the first one the registry does not have yet. Environment variables outrank every npm config file, so the setting survives the --userconfig redirect.
npm attaches a trusted publisher to a single package, not to an org or a scope, so each public workspace package needs its own configuration before the release job's OIDC token exchange is accepted. scripts/npm-trust walks the workspace and runs `npm trust github` for every one of them. The registry refuses to configure a package that does not exist yet, so a newly added package still needs one manual publish before the script can cover it.
|
View your CI Pipeline Execution ↗ for commit 5d843de
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #445 +/- ##
==========================================
+ Coverage 60.78% 60.90% +0.12%
==========================================
Files 29 29
Lines 1614 1614
Branches 369 369
==========================================
+ Hits 981 983 +2
+ Misses 629 627 -2
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ianwremmel
approved these changes
Sep 12, 2026
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.
The trusted publishing switch in #444 got the release job past npm auth, but
the next run died in
prepare:@semantic-release/npmrunsnpm versionwith--userconfigpointed at a tempfile. On the token path
set-npmrc-authwrites that file by concatenating everynpm config file it finds,
~/.npmrcincluded, which is how the job'snpm config set workspaces-update falsereached it. Under trusted publishingverify-authreturns beforeset-npmrc-auth, the temp file is never written,and
--userconfigpointed at a nonexistent path displaces~/.npmrc.workspaces-updatereverts to its default oftrue,npm versionreifies theworkspace, and the
"*"ranges that multi-semantic-release just rewrote to thisrun's unpublished versions fail to resolve.
Setting it as
npm_config_workspaces_updateinstead puts it at npm's env configlevel, which outranks every config file and is unaffected by
--userconfig.Also adds
scripts/npm-trust, which registers GitHub Actions as the trustedpublisher for all 32 public workspace packages. npm stores that per package, so
this is a prerequisite for the OIDC exchange rather than an optimization, and a
new package will need a run of it (after one manual bootstrap publish, since the
registry will not configure a name that does not exist).
Nothing published and no tags were created in the failed run, so there is no
half-released state to unwind.