Skip to content

Patch: Address Failing Check and Add Config.env Check (#25) #5

Patch: Address Failing Check and Add Config.env Check (#25)

Patch: Address Failing Check and Add Config.env Check (#25) #5

Workflow file for this run

name: Push Images
on:
push:
branches: [ main ]
permissions: read-all
jobs:
build:
name: Push Updated Images
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Login to Quay.io
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45.0.4
with:
dir_names: 'true'
- name: Push Changed Images
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
BASE_DIR=$(pwd)
for dir in ${ALL_CHANGED_FILES}; do
echo "Change detected in $dir ..."
cd $dir
if [ ! -f config.env ]; then
echo "No config.env file present in changed directory, skipping ..."
cd $BASE_DIR
continue
fi
source config.env
echo "Running 'docker build' in $dir ..."
if [ -f "Containerfile" ]; then
docker build -t "${IMAGE_NAME}":temp -f Containerfile .
else
docker build -t "${IMAGE_NAME}":temp -f Dockerfile .
fi
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${IMAGE_TAG}" && docker push "${IMAGE_NAME}":"${IMAGE_TAG}"
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${GITHUB_SHA}" && docker push "${IMAGE_NAME}":"${GITHUB_SHA}"
cd $BASE_DIR
done