name: Sync docker images of minikube to Alibaba Cloud

on:
  workflow_dispatch:
  schedule:
    # every day at 7am & 7pm pacific
    - cron: "0 2,14 * * *"

jobs:
  sync-images:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./image-syncer
    steps:
    - uses: actions/checkout@v2
      with:
        repository: denverdino/image-syncer
        path: ./image-syncer

    - name: Set up Go
      uses: actions/setup-go@v2
      with:
        go-version: 1.17

    - name: Build
      run: make

    - name: Synchronize images to Alibaba Cloud Container Registry Service
      env: 
        ACR_USER: ${{ secrets.ACR_USER }}
        ACR_PASSWORD: ${{ secrets.ACR_PASSWORD }}
        DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
        DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}

      run: ./image-syncer --auth=auth.json --images=images.json --days=2 --proc=2

Add github action for synchronization
Add github action for synchronization

Signed-off-by: Li Yi <9b065897ddf8076b8519f3c6d24b707446157dae@gmail.com>
