ci(publish): inline publish steps into publish.yml - #372
Merged
Conversation
npm Trusted Publishing validates the workflow file that contains the literal 'pnpm changeset publish' step. With the previous reusable-workflow pattern, the publish step ran inside the called reusable workflow (_publish-release.yml, _publish-hotfix.yml, _publish-canary.yml), and the OIDC token's workflow_ref claim pointed to that reusable file. The Trusted Publisher entry on npmjs.com was registered with workflow filename 'publish.yml', so the OIDC claims did not match — npm rejected the publish with a misleading E404 (documented npm/cli #9088). The fix is to inline every publish step into publish.yml itself, so the workflow file containing the publish step IS the file registered on npmjs.com. Three jobs (release, hotfix, canary) are now defined directly in publish.yml with their full step lists. The check-release job (added in PR #369) remains as the gating job. Removed: - .github/workflows/_publish-release.yml - .github/workflows/_publish-hotfix.yml - .github/workflows/_publish-canary.yml No code change. No publish triggered by this PR. Post-merge action required: - Update the Trusted Publisher entry on https://www.npmjs.com/package/@deessejs/fp/access to Workflow filename = 'publish.yml' (if it was set to a different value).
3 tasks
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.
Summary
Inlines every publish step into
publish.ymlitself, removing the reusable workflow pattern. Required so npm Trusted Publishing'sworkflow filenamecheck matches the file that contains thepnpm changeset publishstep.Why
npm Trusted Publishing validates the workflow file that literally contains the publish step. With the reusable-workflow pattern (introduced in PR #367), the publish step ran inside the called reusable file (
_publish-release.yml,_publish-hotfix.yml,_publish-canary.yml). The OIDC token'sworkflow_refclaim pointed to that reusable file, not topublish.yml.The Trusted Publisher entry on npmjs.com was registered with workflow filename
release.yml(the original name before PR #367). After PR #367 renamedrelease.yml→_publish-release.yml, the registered filename no longer matched any workflow file. PR #371 then addedid-token: writeto the reusable workflows, which made OIDC proceed far enough to generate the provenance attestation — but the final PUT to npm failed withE404 Not Foundbecause the OIDCworkflow_refclaim (_publish-canary.yml) did not match the registered filename (release.yml). This is documented behavior in npm/cli#9088 — a misleading 404 instead of a clear diagnostic.Root cause: the OIDC
workflow_refclaim must match the filename registered on npmjs.com.Fix: inline every publish step into
publish.ymlso the workflow file containing the publish step IS the file registered on npmjs.com.Changes
.github/workflows/publish.yml: full rewrite. Three jobs (release,hotfix,canary) now contain their step lists inline. Thecheck-releasegating job from PR ci(publish): skip publish paths when no changeset pending #369 is preserved..github/workflows/_publish-release.yml: deleted..github/workflows/_publish-hotfix.yml: deleted..github/workflows/_publish-canary.yml: deleted.4 files changed, +194 / -316.
Required follow-up
After merging this PR, the Trusted Publisher entry on
https://www.npmjs.com/package/@deessejs/fp/accessmust be updated to Workflow filename =publish.yml(currently set torelease.yml). Once updated, the dummy e2e test (PR #370) can be retried and should succeed end-to-end.Senior rationale
The reusable-workflow pattern is elegant for sharing logic across many workflows, but it's a poor fit for npm Trusted Publishing because npm's check is filename-based and the OIDC
workflow_refclaim is the file that runs the publish step. Trying to make the entrypoint + reusable pattern work requires either:Inlining is the pragmatic senior choice. The trade-off (a longer single workflow file) is acceptable: the workflow is still under 250 lines and remains readable.
Test plan
pnpm turbo type-checkpasses.pnpm turbo lintpasses.publish.yml: dummy e2e test (PR docs(fp): dummy e2e release test (1.0.1 -> 1.0.2) #370) re-triggered → canary snapshot publishes on@canarydist-tag with provenance.@latestwith provenance.Risk
Low. No code change. The workflow structure is reorganized but functionally equivalent. The Trusted Publisher filename must be updated; if forgotten, OIDC will continue to fail with E404 (same as before, no regression).
Rollback
Revert the merge commit. Re-add the three
_publish-*.ymlfiles from git history. Update the Trusted Publisher back to the previous filename (if changed).🤖 Generated with Claude Code