name: 'Publish to NPM'
on:
  push:
    branches:
      - 'main'
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: use node v16.x
        uses: actions/setup-node@v3
        with:
          node-version: 16.x

      - name: yarn install
        uses: borales/actions-yarn@v4
        with:
          cmd: install --frozen-lockfile

      - name: yarn build
        uses: borales/actions-yarn@v4
        with:
          cmd: build --frozen-lockfile

      - uses: JS-DevTools/npm-publish@v1
        with:
          token: ${{ secrets.NPM_TOKEN }}
          access: public
          package: ./package.json
