-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.73 KB
/
auto-build-on-base-image-change.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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' }}