deploy_feedback
deploy_feedback copied to clipboard
401 Unauthorized when using a private package (on github registry)
Version: Deno 2.2.3 x-deno-ray: fd06651086befa7f2afe627adc6fe5df
I looked the docs and search a lot, but couldn't find any solution for this issue:
I'm running the build step creating the .npmrc file
Currently the Build Step works well. But the deploy fails with the error bellow:
Error: The deployment failed: HTTP status client error (401 Unauthorized) for url (https://npm.pkg.github.com/@<company>%2fshared-lib)
Note: I tried with permissions.package: read and permissions.package: write usong the ${{secrets.GITHUB_TOKEN}} but haven't worked since the package is outside the repo so I changed to use a PAT
Part of my github actions file:
jobs:
deploy:
name: Deploy
environment: Production
runs-on: ubuntu-latest
permissions:
packages: write # Needed to install private packages
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
....
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.2.3
- name: Build step
run: |
cd backend/deno
echo "@<company>:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_ACCESS_TOKEN }}" >> .npmrc
echo "Caching the index.ts" && deno cache index.ts --allow-import
echo "Running the build" && deno task build --environment production
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "<project name>"
entrypoint: "index.ts" # 📝 Update the entrypoint
root: "./backend/deno" # 📝 Update the root
Looks like a duplicate of https://github.com/denoland/deploy_feedback/issues/819