name: CI

on:
  pull_request:
  push:
    branches:
      - main
      - master
  schedule:
    - cron: "0 3 * * 0" # every Sunday at 3am

env:
  CI: true

jobs:
  # tests:
  #   if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
  #   name: Base Tests
  #   timeout-minutes: 5
  #   runs-on: ubuntu-latest
  #   strategy:
  #     matrix:
  #       node:
  #         - "14"
  #   steps:
  #     - uses: actions/checkout@v2
  #     - uses: volta-cli/action@v1
  #       with:
  #         node-version: ${{ matrix.node }}

  #     - run: yarn install

  #     - name: Test with ${{ matrix.node }}
  #       run: yarn test


  ember-cli-update:
    if: github.event_name == 'pull_request' && github.event.pusher.name == 'renovate-bot'
    runs-on: ubuntu-latest
    # needs: [tests]

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.GitHubToken }}
      - uses: actions/setup-node@v2
      - uses: kellyselden/ember-cli-update-action@v2
        with:
          autofix_command: yarn lint:fix
          ignore_to: true

  publish:
    name: Release
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
    # needs: [tests]

    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false
      - uses: volta-cli/action@v1
      - run: yarn install

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