name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  test:
    name: Test
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        channel:
          - stable
          - beta
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up Atom environment
        uses: UziTech/action-setup-atom@v2
        with:
          version: ${{ matrix.channel }}
      - name: Check Atom version
        run: atom --version
      - name: Check APM version
        run: apm --version
      - name: Install dependencies
        run: apm ci
      - name: Run tests
        run: atom --test spec

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up Node.js environment
        uses: actions/setup-node@v2
      - name: Install dependencies
        run: npm ci
      - name: Run code linter
        run: npm run lint

name: CI

on:
  push:
    branches:
      - master
    tags:
      - v*
  pull_request:
    branches:
      - master

jobs:
  test:
    name: Test
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        channel:
          - stable
          - beta
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up Atom environment
        uses: UziTech/action-setup-atom@v1
        with:
          channel: ${{ matrix.channel }}
      - name: Check Atom version
        run: atom --version
      - name: Check APM version
        run: apm --version
      - name: Install dependencies
        run: apm ci
      - name: Run tests
        run: atom --test spec

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up Node.js environment
        uses: actions/setup-node@v2
      - name: Install dependencies
        run: npm ci
      - name: Run code linter
        run: npm run lint

  publish:
    name: Publish
    runs-on: ubuntu-latest
    if: |
      startsWith(github.ref, 'refs/tags/v') &&
      github.event.repository.fork == false
    needs:
      - test
      - lint
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up Atom environment
        uses: UziTech/action-setup-atom@v1
      - name: Publish to Atom packages
        env:
          ATOM_ACCESS_TOKEN: ${{ secrets.ATOM_ACCESS_TOKEN }}
        run: apm publish --tag "${GITHUB_REF/refs\/tags\//}"

Add publish job to CI workflow
Add publish job to CI workflow
