name: Library Release

on:
  push:
    branches: [main, beta, alpha]

env:
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
  mixgather:
    runs-on: ubuntu-latest

    concurrency:
      group: ${{ github.workflow }}-${{ github.head_ref }}
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v2
      - uses: volta-cli/action@v1
      - run: yarn --frozen-lockfile

      - name: Build
        run: yarn build

      - name: Format check
        run: yarn format:check

      - name: Lint check
        run: yarn lint:check

      - name: Spell check
        run: yarn spell:check

      - name: Test
        run: yarn test

      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: yarn semantic-release
