Actions/setup-node@v2 publish does not work with github packages

Have a setup like this:

name: Node.js Package

on:
  push:
    branches:
    - master

jobs:
  publish-gpr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '12.x'
          registry-url: https://npm.pkg.github.com/
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

And the docs (Publishing Node.js packages - GitHub Docs) say that this should publish to the provided registry-url i.e. to github.
But instead the job tries pushing to npm and my log fails saying that:

Not Found - PUT https://registry.npmjs.org/my-package-name - Not found

It’s my first shot at github actions so not sure if i’m missing something or whether the setup-node action is messed up and doesn’t create the npmrc file properly ?

Do you have a .npmrc or do you have set a regustry url in your package.json? Please post the content.

Your file also looks a bit different from the example here Publishing Node.js packages - GitHub Docs

For example npm install is missing.