Skip to content
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

chore(*): Publish packages with npm provenance #1891

Conversation

LekoArts
Copy link
Member

@LekoArts LekoArts commented Oct 16, 2023

Description

This PR enables our packages to be published with npm provenance:
https://docs.npmjs.com/generating-provenance-statements

Since we are using changesets (ref: changesets/changesets#1152) we can other ways of doing that: https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools

I also added the directory to repository (https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository) because provenance needs this: https://docs.npmjs.com/generating-provenance-statements#prerequisites

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@LekoArts LekoArts requested review from dimkl and a team as code owners October 16, 2023 11:56
@changeset-bot
Copy link

changeset-bot bot commented Oct 16, 2023

🦋 Changeset detected

Latest commit: 1a66fb1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
gatsby-plugin-clerk Patch
@clerk/chrome-extension Patch
@clerk/localizations Patch
@clerk/clerk-js Patch
@clerk/clerk-sdk-node Patch
@clerk/backend Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/shared Patch
@clerk/themes Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/types Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -17,6 +17,6 @@ module.exports = {
'subject-case': [2, 'always', ['sentence-case']],
'body-max-line-length': [1, 'always', '150'],
'scope-empty': [2, 'never'],
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release']],
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release', '*']],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to write a commit message that affects everything inside packages, we should use *. So this just adds it as it was missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing, indeed! Great job!

@@ -15,6 +15,9 @@ jobs:
name: Release
if: ${{ github.repository == 'clerkinc/javascript' }}
runs-on: ${{ vars.RUNNER_LARGE }}
permissions:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts LekoArts marked this pull request as draft October 16, 2023 14:11
@LekoArts
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@@ -15,6 +15,11 @@ jobs:
name: Release
if: ${{ github.repository == 'clerkinc/javascript' }}
runs-on: ${{ vars.RUNNER_LARGE }}
env:
NPM_CONFIG_PROVENANCE: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 We might be able to add provenance=true to the root .npmrc file in the repo, instead of needing to add the environment variable to each release workflow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts It looks like that error might have been because the id-token permission wasn't set yet 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

"nuke": "./scripts/nuke.sh",
"yalc:all": "for d in packages/*/; do echo $d; cd $d; yalc push --replace --sig; cd '../../'; done",
"prepare": "husky install",
"changeset": "npx changeset",
"changeset": "changeset",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to use npx, in fact I believe the current setup didn't allow for environment variables (https://brianchildress.co/environment-variables-using-npx/)

@LekoArts LekoArts marked this pull request as ready for review October 17, 2023 12:18
Copy link
Member

@nikosdouvlis nikosdouvlis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job with this @LekoArts

@LekoArts LekoArts added this pull request to the merge queue Oct 18, 2023
Copy link
Member

@anagstef anagstef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job here @LekoArts 💯

Merged via the queue into main with commit 3bf6410 Oct 18, 2023
12 checks passed
@LekoArts LekoArts deleted the lekoarts/sdk-530-build-and-deploy-packages-using-the-provenance-flag branch October 18, 2023 10:25
@clerk-cookie clerk-cookie mentioned this pull request Oct 18, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants