Build latest images on schedule event #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2024 Intel Corporation | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Build latest images on schedule event | |
on: | |
schedule: | |
- cron: "0 17 * * *" # 5:00 PM UTC every day, 1:00 AM CST every day | |
env: | |
tag: "latest" | |
jobs: | |
check-build: | |
runs-on: ubuntu-latest | |
outputs: | |
run_build: ${{ steps.get-changes.outputs.run_build }} | |
steps: | |
- name: Checkout out Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if build is needed | |
id: get-changes | |
run: | | |
set -x | |
changed_files=$(git log --since="24 hours ago" --name-only --pretty=format: | grep comps/cores | grep -vE '*.md') || true | |
if [ -z "$changed_files" ]; then | |
echo "No changes in the last 24 hours for the 'comps/cores' directory" | |
echo "run_build=false" >> $GITHUB_OUTPUT | |
else | |
echo "Changes detected in the last 24 hours for the 'comps/cores' directory" | |
echo "run_build=true" >> $GITHUB_OUTPUT | |
fi | |
image-build: | |
needs: check-build | |
if: ${{ needs.check-build.outputs.run_build == 'true' }} | |
strategy: | |
matrix: | |
service: | |
["asr", "dataprep", "embeddings", "guardrails", "llms", "reranks", "retrievers", "tts", "web_retrievers"] | |
node: ["docker-build-xeon", "docker-build-gaudi"] | |
runs-on: ${{ matrix.node }} | |
continue-on-error: true | |
steps: | |
- name: Clean Up Working Directory | |
run: | | |
sudo rm -rf ${{github.workspace}}/* | |
- name: Checkout out Repo | |
uses: actions/checkout@v4 | |
- name: Build image | |
env: | |
service: ${{ matrix.service }} | |
uses: opea-project/validation/actions/image-build@main | |
with: | |
work_dir: ${{ github.workspace }} | |
docker_compose_path: ${{ github.workspace }}/.github/workflows/docker/compose/${service}-compose.yaml | |
registry: ${OPEA_IMAGE_REPO} | |
tag: ${tag} |