fix: address autorelease publish failures#85
Conversation
…bort
Three issues in the autorelease workflow:
1. always-auth warnings: OIDC isolation was writing always-auth=false
to the temp .npmrc and setting NPM_CONFIG_ALWAYS_AUTH=false, both of
which npm 10+ treats as unknown and warns about. Removed both.
2. ENEEDAUTH on npm publish: actions/setup-node writes a project .npmrc
with _authToken=${NODE_AUTH_TOKEN}. When NODE_AUTH_TOKEN is unset,
npm expands this to an empty token and fails. Our user-config override
does not affect the project config. Fix: add a workflow step to delete
.npmrc before the release step in OIDC mode, allowing npm trusted
publishing to use the OIDC exchange unimpeded.
3. Pipeline continues after all-publish-failure: publishSucceeded was set
unconditionally to true after the publish stages, so the git push and
GitHub release always ran. Now derived from actual per-package results;
if every attempted package failed the pipeline throws (non-zero exit)
preventing the version commit and tag being pushed. GitHub release is
also gated on ctx.output.git.pushed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously, per-package publish errors were caught and warned about, allowing the pipeline to continue. This let the version commit and tag be pushed even when all packages failed. Now the first failure throws immediately, propagating up through the pipeline's outer catch so git push and GitHub release are never reached. The failed package result is still recorded before throwing so callers have full context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Release Preview — 4 packages
This PR will trigger the following release when merged: Packages
ChangelogProject-wide changesAdded
Changed
Fixed
@releasekit/version v0.3.1 → 0.4.0Added
Changed
Fixed
@releasekit/notes v0.3.1 → 0.4.0Added
Changed
Fixed
@releasekit/publish v0.3.1 → 0.4.0Added
Changed
Fixed
@releasekit/release v0.3.1 → 0.4.0Added
Changed
Fixed
Tags
Updated automatically by ReleaseKit |
- notes/README: remove releasekit-notes init (command was removed) - release/README: document releasekit init command - release/docs/ci-setup: document .npmrc deletion requirement for OIDC trusted publishing; setup-node's injected _authToken causes ENEEDAUTH if not removed before running releasekit in OIDC mode - publish/README: note fail-fast pipeline behaviour Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR fixes autorelease publish failures by addressing three root causes in the OIDC npm publish path, the error-handling strategy in the publish stages, and the ordering of git push relative to GitHub release creation. Key changes:
Confidence Score: 5/5Safe to merge — all remaining findings are minor P2 style suggestions that do not affect correctness. The core logic is sound: fail-fast publish, git.pushed guard for GitHub release, and the sed-based .npmrc cleanup are all correctly implemented and covered by updated tests. The two P2 comments are a debug step that should be cleaned up post-validation and a minor style note on the redundant .every() check — neither blocks merge. .github/workflows/_release.reusable.yml — the Debug .npmrc step should be removed once the fix is confirmed stable in production.
|
| Filename | Overview |
|---|---|
| .github/workflows/_release.reusable.yml | Adds a sed step to strip setup-node auth lines from .npmrc before OIDC publish. Also adds a debug step that logs .npmrc on every OIDC non-dry-run — flagged as a temporary artifact that should be removed. |
| packages/publish/src/pipeline/index.ts | Switches publishSucceeded to a redundant .every() check (safe, fail-fast invariant guarantees true). Adds a git.pushed guard to the GitHub release stage, preventing a release from being created when the tag hasn't reached the remote. |
| packages/publish/src/stages/npm-publish.ts | Changes error strategy from per-package catch (warn and continue) to fail-fast: first publish failure pushes the failed result and immediately throws, aborting the stage. |
| packages/publish/src/stages/cargo-publish.ts | Same fail-fast transition as npm-publish: crate failures now throw immediately instead of warning and continuing. |
| packages/publish/src/utils/npm-env.ts | Removes the always-auth override and related env vars for OIDC mode; the workflow sed step now handles stripping those lines from the project .npmrc directly. |
| packages/publish/test/unit/pipeline.spec.ts | Switches clearAllMocks to resetAllMocks; updates runGitPushStage mock to set git.pushed=true so the GitHub release stage runs in the happy-path order test. |
| packages/publish/test/unit/stages/npm-publish.spec.ts | Adds a fail-fast test verifying that a publish error throws and records the failed result before propagating. |
| packages/publish/test/unit/utils/npm-env.spec.ts | Updates assertions to confirm always-auth is no longer written to the temp .npmrc. |
| packages/publish/README.md | Documents the new fail-fast pipeline behaviour. |
| packages/release/docs/ci-setup.md | Adds ENEEDAUTH root cause explanation and a concrete workflow snippet for the required sed step before OIDC publish. |
Sequence Diagram
sequenceDiagram
participant WF as GitHub Actions Workflow
participant PN as Pipeline (runPipeline)
participant NPM as npm-publish stage
participant GIT as git-push stage
participant GHR as github-release stage
WF->>WF: sed strip auth-token & always-auth from .npmrc
WF->>PN: run releasekit publish
PN->>PN: prepare + git-commit
PN->>NPM: runNpmPublishStage(ctx)
alt publish succeeds
NPM-->>PN: result.success=true pushed
else publish fails (fail-fast)
NPM-->>PN: result.success=false pushed → THROW
PN-->>WF: PipelineError (git push & release skipped)
end
PN->>PN: publishSucceeded = true
PN->>GIT: runGitPushStage(ctx)
GIT->>GIT: git push branch + tags
GIT-->>PN: ctx.output.git.pushed = true
alt git.pushed == true
PN->>GHR: runGithubReleaseStage(ctx)
GHR-->>PN: release created
else git.pushed == false
PN->>PN: skip GitHub release
end
PN-->>WF: PublishOutput
Reviews (4): Last reviewed commit: "docs: update OIDC setup to use sed inste..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.