I have a private repo inside my free github organization. When I try to publish a private package to Github Packages with Actions, I get the following error:
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.
my github action main.yml
file looks like this:
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})
and my package.json
looks like this:
{
"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"
}
What do I need to change to get this working? I also tried to use a personal access token with read/write packages permissions from my github account but this also doesn't work.