Skip to content

Instantly share code, notes, and snippets.

@mkumatag
Created June 2, 2023 17:05
Show Gist options
  • Save mkumatag/b53f7327612296226bf7bab401eae113 to your computer and use it in GitHub Desktop.
Save mkumatag/b53f7327612296226bf7bab401eae113 to your computer and use it in GitHub Desktop.
name: check container image
on:
schedule:
- cron: '0 0 * * *'
env:
REGISTRY: ghcr.io
IMAGE_NAME: mkumatag/hello-world
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Check if container image update required
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Container Image Updater
id: check
uses: mkumatag/container-image-updater-action@v1.0.5
with:
base-image: 'registry.access.redhat.com/ubi8/ubi-minimal:latest'
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Image update
run: echo "Image update required ${{ steps.check.outputs.needs-update }}"
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
if: steps.check.outputs.needs-update == 'true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment