-
Notifications
You must be signed in to change notification settings - Fork 1.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
.npmrc is not created #249
Comments
For anyone who's come across this, my workaround is below, but it feels like a hack since this functionality supposedly exists in - name: Publish Packages
run: |
+ echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ${{ github.workspace }}/.npmrc
cat .npmrc |
I'm not sure - name: Publish Packages
run: |
- cat .npmrc
+ cat $NPM_CONFIG_USERCONFIG |
Thanks @adifelice-godaddy - interesting. Why would it create it anywhere but the repo directory... would you know? The output strangely is the below (with
Do you have a recommendation of how to make this be added to the root directory? If it's more than setting an environment variable, then I'll probably just keep my hack. As in, I don't want to write a line that runs a |
I tried this:
But, there's a file permission error which makes sense, but beyond my understanding of how to fix.
I'm leaning towards just keeping my one line hack, since in order to get this to work with |
Out of curiosity, why do you need the .npmrc file in the repo? I was having an issue with the auth token not working (resulting in 404 errors, of all things!), and went down the path of trying to modify the npmrc, but it turned out that the npm token I'd generated was no longer valid, because they added 2FA or something, and I had to generate a new token for "Automation" :/ Once I updated the token everything worked without manual npmrc mods. |
Sometimes you want to include an |
In a GitHub Action I am publishing to NPM from CI. This issue isn't about answering why I'm doing a thing. This ticket was opened because a documented feature of |
|
Please stop adding comments that are not helpful in resolving this issue. For now I'm just using my workaround. I'm thinking about closing this since it hasn't gotten attention from actual contributors. I'm simply reporting a feature of this project that is broken. My use case isn't very relevant, but since people have been inquiring and for context: it is simple and standard - I have a repo that includes the code for packages to be published to NPM. I'm using The README for this project states that it can be used for In the usage section of the README it provides an example that you might use to setup and environment to publish packages for NPM. See This is the example from the README. steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '10.x'
registry-url: <registry url>
- run: yarn install
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
- uses: actions/setup-node@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} And this setup isn't actually working. |
I'm going to close this due to lack of helpful comments and this project has bigger problems. |
I run on this thread and this is related So, the problem is that actions adds scope, by default your github name. However, the package name doesn't include scope. I fixed it by
anyway, its a bug, scope shouldn't be added right? |
For docker scenario, I ended up
|
Thanks, @longility, your comment really help: I forgot to include the scope in the package name. |
Your code gives me a |
…actions#249) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.28.4 to 4.28.5. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.28.5/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The provided example doesn't work as acknowledged by the `setup-node` team, as of [github#926](actions/setup-node#926 (comment)). This is also a long known problem, see [github#249](actions/setup-node#249). This is considered to be a drastic measure to make sure the `setup-node` team takes responsibility for the problem.
Expected
When
registry-url
input is set withenv.NODE_AUTH_TOKEN
an .npmrc file should be created in project root.Actual
When
registry-url
input is set withenv.NODE_AUTH_TOKEN
an .npmrc file is not created.Reproduction
.github/workflows/publish.yml
package.json
Note: My project is a Lerna based monorepo, so the above package.json has minimal fields. Perhaps, this functionality requires certain fields / values, but I'm not sure why and what those fields would be.
GitHub Action output and linked here.
The text was updated successfully, but these errors were encountered: