-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Publish to NPM with provenance #23917
Conversation
Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>
Muito obrigado @gabibguti ! 🙌 |
@yannbf Imagina!
No. But, double checking the requirements, we need to make sure we are using npm 9.5.0+ when publishing, I'll check if we need to bump actions/setup-node version. And, as far as I understand, all packages being published by storybook are public, can you confirm that? |
Yeah, we need to change actions/setup-node version from |
npm supports publishing with provenance starting at version 9.5.0+. When setting up node in the workflow, we need to use node 18.x+ to make sure we install npm 9.5.0+ to publish with provenance. Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>
That's right, AFAIK!
I believe we use node 16 in our actions because that's the lowest node version that we support, however given that your change only affects the publish workflow, I think it's totally fine. @JReinhold could you confirm? |
There's a subtle but important gotcha here that is blocking this from working. The command: yarn workspaces foreach --parallel --no-private --verbose npm publish --tolerate-republish --tag someTag --provenance
In theory we could instead use yarn workspaces foreach --parallel --no-private --verbose exec 'yarn pack && npm publish --tag someTag --provenance' However that comes with it's own set of problems:
"why would we even do this?" you askWell, the npm registry is super flaky, so when publishing 90 packages at the same time it's not uncommon for some of the packages to silently fail publishing. That's why we have retry logic in place that keeps publishing until all packages are successful. But that retry logic will be much more complex if we're no longer allowed to retry all packages, but have to selectively retry the failed packages.
That's not to say we should not do this PR at all, but we need to solve the above two points as part of this if we want to. |
So it seems like we are blocked from doing this change until this issue is resolved: |
Psst @yannbf! You can work around this issue by packing using Yarn, but publishing using npm: |
My understanding in this case is that we would really need yarn to support the provenance flag. Sorry about that folks, I did not see the tolerate republish problem. As @JReinhold suggested, we can do the yarn pack, then publish with npm, but we would need another logic to perform the retrying the publish for packages (--tolerate-republish), because the publish might fail since we are publishing multiple packages. |
@gabibguti's last comment is correct. I'm closing this for now, we can always re-visit if we want to do the extra work needed. |
Closes #23916
What I did
Adds a flag to publish to npm with provenance.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
publish.yml
(e.g. https://www.npmjs.com/package/next#provenance)
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>