Skip to content

Unable to publish to GitHub Package Registry #953

Closed
@esrathkkm

Description

@esrathkkm

yaml file


on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v1
      - uses: pnpm/action-setup@v2
        with:
          version: 8
      - run: bun i
      - run: pnpm nx build test-library

  publish-gpr:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v1
      - uses: pnpm/action-setup@v2
        with:
          version: 8
      - uses: actions/setup-node@v3
        with:
          node-version: 20
          registry-url: https://npm.pkg.github.com/
      - run: bun i
      - run: pnpm nx build test-library
      - run: npm publish dist/packages/test-library --registry=https://npm.pkg.github.com/
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.npmrc

//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} @esrathkkm:registry=https://npm.pkg.github.com/

but when i do npm publish in local termial dist/packages/test-library --registry=https://npm.pkg.github.com/ , its working fine .
But when i do as github actions . its throwing
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://npm.pkg.github.com/@esrathkkm%2ftest-repo - Permission permission_denied: write_package
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions