Skip to content

Multiple scoped npm repositories with different urls #37

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

Closed
yaronya opened this issue Aug 21, 2019 · 2 comments
Closed

Multiple scoped npm repositories with different urls #37

yaronya opened this issue Aug 21, 2019 · 2 comments
Assignees

Comments

@yaronya
Copy link

yaronya commented Aug 21, 2019

I'm trying to use the actions/setup-node step but in my specific case I have multiple scoped npm repositories with different registry urls,
According to your docs, it seems that there can only be a single registry url per setup-node step so I basically can't use it for my project.
Am I getting something wrong here or is it still not supported?

Thanks.

@damccorm
Copy link
Contributor

You're on the right track here. Basically, there are 2 options available to you.

(1) Don't use setup-node for auth and just configure your .npmrc file separately. If you do this, I'd recommend not checking in your token and instead scoping in an env variable, so it would be something like //registry.npmjs.org:_authToken=${NODE_AUTH_TOKEN} then you would scope in a token. Note that you can still run setup-node to get the correct version of node installed, you'd just omit the registry input.
(2) If you don't need access to them in the same step, you can run setup-node in between different steps. e.g.

steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
  with:
    node-version: '10.x'
    registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish
  env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v1
  with:
    registry-url: 'https://npm.pkg.github.com'
- run: npm publish
  env:
    NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

At least right now we don't support authenticating to multiple registries at once though

@damccorm damccorm self-assigned this Aug 26, 2019
@damccorm
Copy link
Contributor

Closing since I think this has been answered, please comment if it should be reopened!

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
…jOkeanij

docs: add DmitrijOkeanij as a contributor
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

No branches or pull requests

2 participants