name: Updater CI

on: workflow_dispatch

jobs:
  release-update:
    runs-on: macos-latest
    if: startsWith(github.repository, 'zzzgydi')
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Get yarn cache dir path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - name: Yarn Cache
        uses: actions/cache@v2
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Yarn install
        run: yarn install

      - name: Release updater file
        run: yarn run updater
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
