Skip to content

fix(ci): propagate npm publish exit code through tee pipeline#232

Open
Leechael wants to merge 3 commits intomainfrom
fix/release-npm-publish-silent-failure
Open

fix(ci): propagate npm publish exit code through tee pipeline#232
Leechael wants to merge 3 commits intomainfrom
fix/release-npm-publish-silent-failure

Conversation

@Leechael
Copy link
Copy Markdown
Collaborator

Problem

In the Publish to npm step of release-npm.yml, the publish command pipes output through tee:

npm publish --access public --tag "$NPM_TAG" --verbose 2>&1 | tee publish.log || {
  echo "Publish failed!"
  exit 1
}

In bash, the exit code of a pipeline is taken from the last command (tee), not from npm publish. Since tee always exits 0, the || { exit 1 } handler never fires even when npm publish fails. 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 reported completed: success.

Fix

Add set -o pipefail at the top of the step. This makes bash treat a pipeline as failed if any command in it fails, so npm publish failures 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 phala and @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.

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.
@Leechael
Copy link
Copy Markdown
Collaborator Author

!release js patch

@github-actions
Copy link
Copy Markdown
Contributor

🚀 @Leechael release command accepted: js patch.

Target branch: fix/release-npm-publish-silent-failure (open PR). Version commits will be pushed to this branch.
The release workflow is queued; results will be posted here.

@github-actions
Copy link
Copy Markdown
Contributor

🎉 Release completed: js v0.2.8

📦 Package Info

  • Package size: size: 167.9
  • Unpacked size: size: 1.5
  • Total files: files:
📄 Files included
11.4kB LICENSE
2.7kB README.md
5.8kB dist/actions/apps/check_app_cvms_is_allowed.d.ts
4.0kB dist/actions/apps/check_app_is_allowed.d.ts
34.5kB dist/actions/apps/get_app_attestation.d.ts
1.2kB dist/actions/apps/get_app_cvms.d.ts
3.8kB dist/actions/apps/get_app_device_allowlist.d.ts
1.6kB dist/actions/apps/get_app_filter_options.d.ts
1.2kB dist/actions/apps/get_app_info.d.ts
3.0kB dist/actions/apps/get_app_list.d.ts
1.9kB dist/actions/apps/get_app_revision_detail.d.ts
1.7kB dist/actions/apps/get_app_revisions.d.ts
3.9kB dist/actions/blockchains/abi/dstack_app.d.ts
2.6kB dist/actions/blockchains/add_compose_hash.d.ts
2.5kB dist/actions/blockchains/add_device.d.ts

@Leechael
Copy link
Copy Markdown
Collaborator Author

!release cli patch

@github-actions
Copy link
Copy Markdown
Contributor

🚀 @Leechael release command accepted: cli patch.

Target branch: fix/release-npm-publish-silent-failure (open PR). Version commits will be pushed to this branch.
The release workflow is queued; results will be posted here.

@github-actions
Copy link
Copy Markdown
Contributor

🎉 Release completed: cli v1.1.17

📦 Package Info

  • Package size: size: 146.3
  • Unpacked size: size: 541.1
  • Total files: files:
📄 Files included
11.4kB LICENSE
3.8kB README.md
29.6kB dist/api/index.d.ts
113.8kB dist/api/index.js
20B dist/index.d.ts
380.5kB dist/index.js
1.9kB package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant