Nul*_*ble 10 npm github-actions
我正在尝试通过 github 操作在 github 注册和 npm 注册上发布我的 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`
Run Code Online (Sandbox Code Playgroud)
为什么我需要npm adduser。我使用自动化令牌,这还不够吗?
这是我的工作流程文件:
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`
Run Code Online (Sandbox Code Playgroud)
我缺少什么?
小智 1
我不知道为什么。但在工作流程中,npm 更喜欢只在 package.json 中发布配置。
我在工作中使用jq来欺骗它。
- name: Publish to github registry
run: |
# Change publish registry
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json
# Add organisation scope to package name
echo "$(jq '.name = "@scope/package"' package.json)" > package.json
# And publish this boy
npm publish --@scope:registry=https://npm.pkg.github.com
Run Code Online (Sandbox Code Playgroud)
我的完整工作流程文件将包发布到两个注册表: https ://github.com/zenfuse/zenfuse.js/blob/21de49de28ab99cb8634e3b0c4bf30078f80eab3/.github/workflows/package-publish.yml
| 归档时间: |
|
| 查看次数: |
2182 次 |
| 最近记录: |