fix(ci): propagate npm publish exit code through tee pipeline#232
Open
fix(ci): propagate npm publish exit code through tee pipeline#232
Conversation
Without set -o pipefail, the exit code of `npm publish ... | tee publish.log` is taken from tee (always 0), not from npm. A failed publish silently passes the step and the || handler never fires, causing the workflow to report success even when nothing was actually published to npm.
Collaborator
Author
|
!release js patch |
Contributor
|
🚀 @Leechael release command accepted: Target branch: |
Contributor
|
🎉 Release completed:
📦 Package Info
📄 Files included |
Collaborator
Author
|
!release cli patch |
Contributor
|
🚀 @Leechael release command accepted: Target branch: |
Contributor
|
🎉 Release completed:
📦 Package Info
📄 Files included |
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.
Problem
In the
Publish to npmstep ofrelease-npm.yml, the publish command pipes output throughtee:In bash, the exit code of a pipeline is taken from the last command (
tee), not fromnpm publish. Sinceteealways exits 0, the|| { exit 1 }handler never fires even whennpm publishfails. The step reports success and the workflow continues normally — creating tags, GitHub releases, and success comments — while the package was never actually published to npm.This is what happened in PR #231: all three release runs (
@phala/[email protected],[email protected],[email protected]) silently failed at publish but the workflow reportedcompleted: success.Fix
Add
set -o pipefailat the top of the step. This makes bash treat a pipeline as failed if any command in it fails, sonpm publishfailures will now correctly propagate and fail the step.Note
The publish failures in PR #231 were also caused by OIDC Trusted Publishers not being configured on npmjs.com for
phalaand@phala/cloud. That requires a separate fix in the npmjs package settings. Once Trusted Publishers are configured, those releases will need to be re-triggered.