Mitya
Mitya

Reputation: 34596

Github action to create a package not firing when release created

I'm trying to automatically create a package whenever I publish a release to my private repo, so that I can use that package as a private dependency in another project.

To this end I have a file at /.github/workflows/release-package.yaml, as per this guide, with the following content:

   name: Node.js Package
    on:
      release:
        types: [created]
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 16
          - run: npm ci
          - run: npm test
      publish-gpr:
        needs: build
        runs-on: ubuntu-latest
        permissions:
          packages: write
          contents: read
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 16
              registry-url: https://npm.pkg.github.com/
          - run: npm ci
          - run: npm publish
            env:
              NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

But the action never runs - if I go to Actions, I see it, but it says no workflow runs, and subsequently the package is never created. There is no feedback - just nothing happens.

In my package.json the relevant parts are:

{
  ...
  "owner": "@my-gh-user/shared-code",
  "publishConfig": {
    "@my-gh-username:registry": "https://npm.pkg.github.com"
  }
  ...
}

What am I doing wrong?

Upvotes: 0

Views: 29

Answers (0)

Related Questions