name: build

on:
  push:
    tags: [v*]
    branches: [master]
  pull_request:

jobs:
  check:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]

    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'yarn'
      - name: Install dependencies
        run: yarn --frozen-lockfile
      - name: Check
        run: yarn run check

  release:
    needs: [check]

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'
          cache: 'yarn'
      - name: Install dependencies
        run: yarn --frozen-lockfile
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release@19
      - name: Coverage
        run: yarn coverage

name: build

on:
  push:
    tags: [v*]
    branches: [master]
  pull_request:

jobs:
  check:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]

    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'yarn'
      - name: Install dependencies
        run: yarn --frozen-lockfile
      - name: Check
        run: yarn run check
      - name: Coverage
        run: yarn coverage

  release:
    needs: [check]

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'
          cache: 'yarn'
      - name: Install dependencies
        run: yarn --frozen-lockfile
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release@19

Move coverage step from release to check job
ci: Move coverage step from release to check job
