Image update check #201
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
# FILE LOCATION IN REPOSITORY: | |
# | |
# .github/workflows/auto-build-on-base-image-change.yml | |
# | |
name: Regular base image update check | |
on: | |
schedule: | |
- cron: "0 23 * * *" | |
workflow_dispatch: | |
inputs: | |
force_build: | |
description: 'Force docker image build.' | |
default: false | |
required: false | |
type: boolean | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Docker Image Update Checker | |
id: baseupdatecheck | |
uses: lucacome/[email protected] | |
with: | |
base-image: pihole/pihole:latest | |
image: phynias/pihole-regex # update for your image | |
# only execute subsequent steps if an update is actually NEEDED. | |
# unfortunately we need to add an if-condition to all steps now | |
# because a clean exit can't be triggered within a job it seems | |
# (a cancellation is NOT the same and triggers a failure email) | |
# see also https://github.com/actions/runner/issues/662 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: ${{ steps.baseupdatecheck.outputs.needs-updating == 'true' || github.event.inputs.force_build == 'true' }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: "${{ github.workspace }}" | |
push: true | |
tags: phynias/pihole-regex:latest # update for your image | |
if: ${{ steps.baseupdatecheck.outputs.needs-updating == 'true' || github.event.inputs.force_build == 'true' }} |