Unable to publish to GitHub Package Registry
See original GitHub issueI use the workflow you suggest, but the npm publish
action on GitHub Package Registry doesn’t work. On npmjs it works.
Workflow
name: publish
on: release
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test
# works
publish-npm:
name: Publish NPM
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# doesn't work: tries to publish on https://registry.npmjs.org
publish-gpr:
name: Publish GitHub Packages
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
registry-url: 'https://npm.pkg.github.com'
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
npm publish on npmjs works. On gpr doesn’t. Follows the GitHub Action output of the publish-gpr job.
Run actions/setup-node@v1
with:
registry-url: https://npm.pkg.github.com
node-version: 10.x
in/tar xzC /home/runner/work/_temp/bc5bc42b-b229-41ac-b8a0-e554467f0c90 -f /home/runner/work/_temp/5cda4e3f-6051-4aaa-b41f-c4761c6cac12
##[add-path]/opt/hostedtoolcache/node/10.16.3/x64/bin
##[set-env name=NPM_CONFIG_USERCONFIG;]/home/runner/work/_temp/.npmrc
##[set-env name=NODE_AUTH_TOKEN;]XXXXX-XXXXX-XXXXX-XXXXX
Added matchers: 'tsc'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/tsc.json
Added matchers: 'eslint-stylish'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/eslint-stylish.json
Added matchers: 'eslint-compact'. Problem matchers scan action output for known warning or error strings and report these inline.
##[add-matcher]/home/runner/work/_actions/actions/setup-node/v1/.github/eslint-compact.json
Run npm publish
npm publish
shell: /bin/bash -e {0}
env:
NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
NODE_AUTH_TOKEN: ***
npm notice [...]
npm notice total files: 18
npm notice
npm ERR! code E401
npm ERR! 401 Unauthorized - PUT https://registry.npmjs.org/https-localhost - You must be logged in to publish packages.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2019-09-04T13_02_57_793Z-debug.log
##[error]Process completed with exit code 1.
As you can see in Run actions/setup-node@v1 the registry-url is right, in Run npm publish is not.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:30 (2 by maintainers)
Top Results From Across the Web
Unable to publish Github package #269
I am trying to setup a workflow that publishes a Github package, but I can't seem to make it work. ... But the...
Read more >Unable to publish unscoped packages to the ... - GitHub
The npm publish step in the above workflow fails with the following error: npm ERR! 401 Unauthorized - PUT https://npm.pkg.github.com/@remarkjs/ ...
Read more >Unable to publish to the GitHub Registry · Issue #130 · actions ...
The problem I'm having is that every time I publish it says I must authenticate, except it's providing a URL related to the...
Read more >Working with the npm registry - GitHub Docs
You can configure npm to publish packages to GitHub Packages and to use packages stored on GitHub Packages as dependencies in an npm...
Read more >Unable to publish JAR ot Github Package Registry due to 404
I believe the problem is that you need to specify the repository you want to associate with your package, not the package name....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Github Package doc
Regarding occurs 500 error on publishing, I have been bumped the same error on my repo for a while, but I have confirmed it resolved on my repo today.
It works well with the following workflow:
Also, the following settings are not required:
.npmrc
file is not requiredpublishConfig
in thepackage.json
file is not requiredYou might want to try publishing to GPR again.