-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use GitHub Actions to publish npm package error: login required #342
Comments
Hello @yisibl . I've tried to reproduce the issue by my own, but it works as expected. Could you please provide minimum repro steps to reproduce the issue outside of your repository. I suppose the issue can be related to the fact that the package is published. Possibly you need to change version in package.json |
Hello @yisibl. Just a gentle ping. Do you have any updates ? |
We had the issue on Nx for our nightly tests that use Verdaccio as a local registry. The publishing was passing on Ubuntu, but failing on MacOs and Windows machines. The fix is to explicitly specify - name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
registry-url: http://localhost:4872 # url to our Verdaccio registry This was introduced with version |
Hello @meeroslav. Thank you for your response. Could you please create a separate issue on it, if it's still relevant for you. Could you please provide such information as:
Actually It was nothing changed regarding to the publishing logic in |
Hello! Action is here: https://github.com/AlexxNB/migy/blob/master/.github/workflows/test-and-publish.yml |
Hello @AlexxNB. Thank you for your report. Could please check section Publish to npmjs and GPR with npm. For authentication you should provide registry. Moreover, you can check this documentation. Besides, possablly you'll need to provide a scope of the package. |
@dmitry-shibanov thanks, it works now. I was completely sure that |
Hello everyone. For now I'm closing the issue because we can't reproduce it from our side. If you have any concerns feel free to contact us or create a new issue. |
This happens to me when using Node < 16 as runner. In my case I am trying to run/build with the same node version as is used in AWS lambdas: 14.17 is the version where we work against. |
Hey @martinheidegger. Thank you for your reply. Could you create a separate issue about this if it's still relevant for you, and if it is, please provide minimal reproduction steps. |
I wonder if it needed more highlighting! @_@ |
it works? |
it works for me too, |
To sum up, all the parts required to make it work:
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
Finally, my release-please workflow file looks like this: name: release-please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node
# The logic below handles the npm publication.
# The if statements ensure that a publication only occurs when a new release is created.
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# The registry-url must be set for authentication to work on the npm publish step
# Ref: https://github.com/actions/setup-node/issues/342#issuecomment-950119520
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
registry-url: 'https://registry.npmjs.org'
- run: npm ci
if: ${{ steps.release.outputs.release_created }}
# Make sure that the NPM_TOKEN has been set as a "Repository secret"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }} |
https://github.com/yisibl/resvg-js/runs/3846453308?check_suite_focus=true
CI: https://github.com/yisibl/resvg-js/blob/d2c05784fe391f6ecdb46dbc129d467a167e239c/.github/workflows/CI.yaml#L455-L500
The text was updated successfully, but these errors were encountered: