Describe the bug
I'm running yarn workspaces foreach npm publish in a GitHub Action workflow. When the workflow runs this step, it results in the successful publishing of all workspaces, yet the command exits with an error code of 1. I'm publishing the packages to a private registry, I don't know if the bug is also present in case of a public one.
Some logs:
Run yarn workspaces foreach npm publish
yarn workspaces foreach npm publish
shell: /bin/bash -e {0}
➤ YN0000: Usage Error: Private workspaces cannot be published
➤ YN0000:
➤ YN0000: $ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish]
➤ YN0000: ➤ YN0000: README.md
...
➤ YN0000: ➤ YN0000: package.json
➤ YN0000: ➤ YN0000: Package archive published
➤ YN0000: ➤ YN0000: Done in 1.35s
➤ YN0000: Done in 23.85s
Error: Process completed with exit code 1.
To Reproduce
yarn workspaces foreach npm publish in one of its steps.Screenshots
If applicable, add screenshots to help explain your problem.
Environment if relevant (please complete the following information):
Linux version 5.3.0-1032-aws (buildd@lgw01-amd64-026) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #34~18.04.2-Ubuntu SMP as given by cat /proc/versionAdditional context
Add any other context about the problem here.
➤ YN0000: Usage Error: Private workspaces cannot be published
That sounds like an error 🙂
It's trying to publish the root (private) workspace, you need to exclude it
@arcanis I get a similar (if not the same) output on my machine but the command exits with 0. This error refers to the case when yarn workspaces foreach invokes the command for the top-level/root workspace.
It's trying to publish the root (private) workspace, you need to exclude it
@merceyz how do I exclude it?
It's trying to publish the root (private) workspace, you need to exclude it
@merceyz how do I exclude it?
You can exclude it using --no-private, https://yarnpkg.com/cli/workspaces/foreach#options-private
yarn workspaces foreach --no-private npm publish
@merceyz thank you, it worked with --no-private 🙂
Most helpful comment
You can exclude it using
--no-private, https://yarnpkg.com/cli/workspaces/foreach#options-private