【发布时间】:2022-10-21 22:06:31
【问题描述】:
我正在尝试通过 github 操作在 github register 和 npm register 上发布我的 npm 包。 github 一个成功,但另一个失败,如下所示:
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://npm.pkg.github.com/nullndr
npm ERR! need auth You need to authorize this machine using `npm adduser`
为什么我需要npm adduser。我使用自动化令牌,还不够吗?
这是我的工作流程文件:
# 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://help.github.com/actions/language-and-framework-guides/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
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/
scope: "@nullndr"
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_NPM_TOKEN }}
我错过了什么?
【问题讨论】:
标签: npm github-actions