name: Publish to npm
on:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: yarn install --frozen-lockfile
      - run: yarn test
      - run: yarn build

  publish-npm:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: yarn config set version-git-message "Released v%s"
      - run: yarn version --new-version ${{github.event.release.tag_name}}
      - run: yarn publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
      - run: git push
        env:
          github-token: ${{ secrets.GITHUB_TOKEN }}

name: Publish to npm
on:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: yarn install --frozen-lockfile
      - run: yarn test
      - run: yarn build

  publish-npm:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: yarn config set version-git-message "Released v%s"
      - run: yarn version --new-version ${{ github.event.release.tag_name }}
      - run: yarn publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
      - run: git config user.email "ruben@kislaki.net"
      - run: git config user.name "Ruben"
      - run: git push
        env:
          github-token: ${{ secrets.GITHUB_TOKEN }}

Configure git before doing a push
Configure git before doing a push
