0

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?

11
  • Are you creating the release from another workflow? If so, you must use a PAT to trigger further workflows. Commented Jan 29 at 18:29
  • This question is similar to: GitHub Actions on release created workflow trigger not working. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Jan 29 at 18:29
  • @BenjaminW. no, I'm making releases manually via the GH dash. Commented Jan 29 at 18:31
  • Does the workflow file live in the default branch? Commented Jan 29 at 19:47
  • 1
    (I have retracted the close vote, as this scenario is different from the suggested duplicate.) Commented Jan 29 at 19:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.