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

Publish to GitHub packages in addition to npmjs #1330

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

harmony7
Copy link
Member

@harmony7 harmony7 commented Oct 24, 2024

This PR updates the NPM package publish workflow to publish to GitHub packages in addition to npmjs.

There are a few changes here:

  • The proposed change now uses the workflow described in https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-nodejs-packages to use the setup-node action to set up the node environment. As a result of this action, the following is added to .npmrc in the runner (including the variable placeholder):

    //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
    registry=https://registry.npmjs.org/
    always-auth=true
    
  • After this we add the following line to .npmrc by invoking npm config set:

    //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
    
  • Now, when publishing to npmjs, we set the environment value NODE_AUTH_TOKEN to the NPM publish token, which is resolved as npm publish reads .npmrc.

  • After that, there is a new step that publishes to GitHub packages, which sets the registry for the @fastly scope to npm.pkg.github.com. For this step we set the environment value NODE_AUTH_TOKEN to the GitHub token, which is resolved as npm publish reads .npmrc.

@harmony7 harmony7 requested a review from kpfleming October 24, 2024 09:33
@harmony7
Copy link
Member Author

Thanks for the quick review, @Integralist !

I'm also going to ask for @kpfleming to give it a once over, and then we'll merge it.

@harmony7 harmony7 merged commit a6a5629 into main Oct 24, 2024
9 checks passed
@harmony7 harmony7 deleted the kats/publish-to-github branch October 24, 2024 16:18
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.

3 participants