nrwl / nx

Smart Monorepos · Fast CI

Home Page:https://nx.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't publish packages to other registry than npm registry

melishev opened this issue · comments

Current Behavior

My Github Action tries to release an update to my packages in the GitHub container registry, but I get a 401 error:

Expected Behavior

Publishing to GitHub package registry will be seamless

GitHub Repo

No response

Steps to Reproduce

Nx Report

Node   : 20.13.1
OS     : darwin-arm64
npm    : 10.5.2

nx             : 19.4.0
@nx/js         : 19.4.0
@nx/workspace  : 19.4.0
@nx/devkit     : 19.4.0
@nrwl/tao      : 19.4.0
typescript     : 5.5.2

Failure Logs

nx run @melishev/prettier-config:nx-release-publish
  
  Something unexpected went wrong when checking for existing dist-tags.
   Error: Command failed: npm view @melishev/prettier-config versions dist-tags --json --"@melishev:registry=https://npm.pkg.github.com"
  npm error code E401
  npm error 401 Unauthorized - GET https://npm.pkg.github.com/@melishev%2fprettier-config - unauthenticated: User cannot be authenticated with the token provided.
  
  npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2024-07-08T18_11_07_628Z-debug-0.log
  
      at genericNodeError (node:internal/errors:984:15)
      at wrappedFn (node:internal/errors:538:14)
      at checkExecSyncError (node:child_process:890:11)
      at execSync (node:child_process:962:15)
      at runExecutor (/home/runner/work/project/project/node_modules/@nx/js/src/executors/release-publish/release-publish.impl.js:70:57)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async promiseToIterator (/home/runner/work/project/project/node_modules/nx/src/command-line/run/run.js:33:11)
      at async getLastValueFromAsyncIterableIterator (/home/runner/work/project/project/node_modules/nx/src/utils/async-iterator.js:15:19)
      at async iteratorToProcessStatusCode (/home/runner/work/project/project/node_modules/nx/src/command-line/run/run.js:44:29)
      at async handleErrors (/home/runner/work/project/project/node_modules/nx/src/utils/params.js:9:24) {
    status: 1,
    signal: null,
    output: [
      null,
      <Buffer 7b 0a 20 20 22 65 72 72 6f 72 22 3a 20 7b 0a 20 20 20 20 22 63 6f 64 65 22 3a 20 22 45 34 30 31 22 2c 0a 20 20 20 20 22 73 75 6d 6d 61 72 79 22 3a 20 ... 177 more bytes>,
      <Buffer 6e 70 6d 20 65 72 72 6f 72 20 63 6f 64 65 20 45 34 30 31 0a 6e 70 6d 20 65 72 72 6f 72 20 34 30 31 20 55 6e 61 75 74 68 6f 72 69 7a 65 64 20 2d 20 47 ... 247 more bytes>
    ],
    pid: 7603,
    stdout: <Buffer 7b 0a 20 20 22 65 72 72 6f 72 22 3a 20 7b 0a 20 20 20 20 22 63 6f 64 65 22 3a 20 22 45 34 30 31 22 2c 0a 20 20 20 20 22 73 75 6d 6d 61 72 79 22 3a 20 ... 177 more bytes>,
    stderr: <Buffer 6e 70 6d 20 65 72 72 6f 72 20 63 6f 64 65 20 45 34 30 31 0a 6e 70 6d 20 65 72 72 6f 72 20 34 30 31 20 55 6e 61 75 74 68 6f 72 69 7a 65 64 20 2d 20 47 ... 247 more bytes>
  }

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

A fragment of my action that causes the release command to be executed:

- name: Publish Libraries
        run: npx nx release --yes
        shell: bash
        env:
          NODE_AUTH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}

The token I pass has read and publish packet permissions

Okay, issuing a classic token with full rights helped me.

My mistake, but it took me a long time to figure it out, thanks for the project!

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.