# This is a basic workflow to help you get started with Actions

name: Build Images

# Controls when the action will run. 
on: 
  push:
    branches:
      - master
    paths:
      - latest-versions.json
      - recommended-versions.json
      - Dockerfile
      - build-images.sh
      - fetch-versions.sh
      - .github/workflows/*
  schedule:
    - cron:  '0 0 * * *'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v2
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Build and push
        env:
          EVENT_NAME: "${{ github.event_name }}"
        run: ./build-images.sh