name: validate
on:
  push:
    branches:
      - 'main'
  pull_request: {}
jobs:
  release:
    runs-on: ubuntu-latest
    if:
      ${{ github.repository == 'kentcdodds/cloc' && contains('refs/heads/main',
      github.ref) && github.event_name == 'push' }}
    steps:
      - name: 🛑 Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ secrets.GITHUB_TOKEN }}

      - name: ⬇️ Checkout repo
        uses: actions/checkout@v2

      - name: ⎔ Setup node
        uses: actions/setup-node@v1
        with:
          node-version: 16

      - name: 🚀 Release
        uses: cycjimmy/semantic-release-action@v2
        with:
          semantic_version: 17
          branches: |
            [
              'main',
            ]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
