name: Test & Publish

on: [push]

jobs:

  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x, 14.x]
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: yarn install
      - run: yarn run build
      - run: yarn run test
      - run: yarn run cover
      - run: yarn run coveralls

    # Send coverage report to Coveralls
      - name: Coveralls
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
  
  publish:
   needs: test
   runs-on: ubuntu-latest
   if: startsWith(github.ref, 'refs/tags/')
   steps:
     - uses: actions/checkout@master
     - uses: actions/setup-node@v1
       with:
         node-version: 14
         registry-url: https://registry.npmjs.org/
     - run: yarn
     - run: yarn run build
     - run: yarn publish
       env:
         NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

name: Test & Publish

on: [push]

jobs:

  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [16.x, 18.x]
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: yarn install
      - run: yarn run build
      - run: yarn run test
      - run: yarn run cover
      - run: yarn run coveralls

    # Send coverage report to Coveralls
      - name: Coveralls
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
  
  publish:
   needs: test
   runs-on: ubuntu-latest
   if: startsWith(github.ref, 'refs/tags/')
   steps:
     - uses: actions/checkout@master
     - uses: actions/setup-node@v1
       with:
         node-version: 16
         registry-url: https://registry.npmjs.org/
     - run: yarn
     - run: yarn run build
     - run: yarn publish
       env:
         NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

Upgrade github action node version to 14+
Upgrade github action node version to 14+
