我如何在私人组织回购中发布带有GitHub操作的私人GitHub包? [英] How can I publish a private github package with github actions inside a private organization repo?
本文介绍了我如何在私人组织回购中发布带有GitHub操作的私人GitHub包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的免费GitHub组织中有一个私人回购。当我尝试使用操作将私有程序包发布到Github程序包时,我收到以下错误:
npm ERR! 401 Unauthorized - PUT https://npm.pkg.github.com/@organization%2ftailwind - Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
我的GitHub操作main.yml
文件如下:
name: Node.js Package
on:
push:
branches:
- main
jobs:
publish-gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@organization'
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: $({secrets.GITHUB_TOKEN})
我的package.json
如下所示:
{
"name": "@organization/tailwind",
"version": "1.0.0",
"description": "My Package Description",
"main": "index.js",
"publishConfig": {
"registry": "https://npm.pkg.github.com/@organization"
},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/organization/tailwind.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/organization/tailwind/issues"
},
"homepage": "https://github.com/organization/tailwind#readme"
}
我需要更改什么才能使其正常工作?我还尝试从我的GitHub帐户使用具有读/写程序包权限的个人访问令牌,但同样不起作用。
推荐答案
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
我的工作配置未在注册表中包括我的组织名称。
这篇关于我如何在私人组织回购中发布带有GitHub操作的私人GitHub包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文