setup-node icon indicating copy to clipboard operation
setup-node copied to clipboard

Npm public login require but new bug

Open plsgivemeachane opened this issue 1 year ago • 5 comments

npm notice === Tarball Details === npm notice name: @quanvndev/waterx
npm notice version: 1.0.5
npm notice filename: @quanvndev/waterx-1.0.5.tgz
npm notice package size: 129.4 kB
npm notice unpacked size: 525.8 kB
npm notice shasum: 8edca9b93551a8d8806cace4fdeea3734f9683a5 npm notice integrity: sha512-8a4WKePggCg3l[...]zvROWUZgv8gpg== npm notice total files: 32
npm notice npm ERR! code ENEEDAUTH npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/ npm ERR! need auth You need to authorize this machine using npm adduser

npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/logs/2024-02-27T01_2058_187Z-debug-0.log Error: Process completed with exit code 1. Description: Github actions bug need login when already pass through the GITHUB_ACTION token already read other duppilcate closed issue

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - run: npm ci
      - run: npm test

  publish-gpr:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
          registry-url: https://npm.pkg.github.com/
      - run: npm ci
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

plsgivemeachane avatar Feb 27 '24 01:02 plsgivemeachane

Hello @plsgivemeachane Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

HarithaVattikuti avatar Feb 27 '24 21:02 HarithaVattikuti

Hi @plsgivemeachane, we've conducted a test on our end using an auth token to publish the registry, and it completed without any errors. Here's a screenshot for your reference. Could you please verify if you're using the correct auth token with the necessary publishing permissions? Image 20-03-24 at 8 18 PM

gowridurgad avatar Mar 19 '24 14:03 gowridurgad

Hi @plsgivemeachane, we've conducted a test on our end using an auth token to publish the registry, and it completed without any errors. Here's a screenshot for your reference. Could you please verify if you're using the correct auth token with the necessary publishing permissions?

Image 20-03-24 at 8 18 PM

I thought that the github token are created in runtime, isn't it?

plsgivemeachane avatar Mar 19 '24 14:03 plsgivemeachane

I thought that the github token are created in runtime, isn't it?

To publish npm in our GitHub registry, we may follow one of two methods:

  1. Generate a token from the official npm website and assign it to secrets.NPM_TOKEN. At runtime, GITHUB_TOKEN will be created using the access provided from npm. env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  • uses: actions/setup-node@v4 with: registry-url: 'https://npm.pkg.github.com/'
  • run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1. If we prefer to publish through our GitHub repository, we need to create a secret with the access token of our repository. steps:
  • uses: actions/checkout@v3
  • uses: actions/setup-node@v3 with: node-version: 16 registry-url: https://npm.pkg.github.com/
  • run: npm install
  • run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.GIT_TOKEN}} In both cases, the NODE_AUTH_TOKEN is used in the environment for authentication.

gowridurgad avatar Mar 21 '24 05:03 gowridurgad

Hello @plsgivemeachane Just a gentle reminder!

gowridurgad avatar Apr 15 '24 04:04 gowridurgad

Hello @plsgivemeachane, Due to inactivity, I'm going to close this issue for now. Please feel free to reopen this issue or create a new one if necessary. Thank you.

gowridurgad avatar May 02 '24 11:05 gowridurgad