name: 'Publish to NPM'
on:
  push:
    branches:
      - 'main'

concurrency: ${{ github.workflow }}-${{ github.ref }}

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: Create Release Pull Request or Publish
        id: changesets
        uses: changesets/action@v1
        with:
          publish: yarn run release
        env:
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
