name: Publish

on:
  push:
    branches:
      - canary

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build, test, Publish
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: yarn install --frozen-lockfile
      - run: yarn test
        env:
          CI: true
      - name: Publish to npm
        run: yarn run lerna publish from-git --npm-tag canary --yes
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

name: Publish

on:
  push:
    branches:
      - canary

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build, test, Publish
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: yarn install --frozen-lockfile
      - run: yarn test
        env:
          CI: true
      - name: Potentially save npm token
        run: |
          ([[ ! -z ${{ secrets.NPM_TOKEN }} ]] && echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc) || echo "Did not write npm token"
      - name: Publish to npm
        run: yarn run lerna publish from-git --npm-tag canary --yes
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Save npm token to .npmrc
Save npm token to .npmrc
