ci: force image build if source changes

This commit is contained in:
Markus Küffner
2024-12-15 21:52:49 +00:00
parent 784aaceb4f
commit f06e1bfcc9
3 changed files with 61 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
name: 'Build and Publish Images on Push'
on:
push:
branches:
- main
paths:
- docker/**
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
apps: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
klipper:
- docker/klipper/**
klipperscreen:
- docker/klipperscreen/**
moonraker:
- docker/moonraker/**
ustreamer:
- docker/ustreamer/**
build:
needs: changes
if: ${{ needs.changes.outputs.apps != '' && toJson(fromJson(needs.changes.outputs.apps)) != '[]' }}
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.changes.outputs.apps) }}
runs-on: ubuntu-latest
steps:
- name: "[prind] checkout"
uses: actions/checkout@v4
- name: "[prind] set up build environment"
uses: ./.github/actions/image-build-common
- name: "[docker] login"
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "[prind] build"
run: |
python3 scripts/build/build.py ${{ matrix.app }} \
--backfill 0 \
--platform linux/amd64 \
--platform linux/arm/v6 \
--platform linux/arm/v7 \
--platform linux/arm64/v8 \
--registry docker.io/${{ secrets.DOCKERHUB_USERNAME }} \
--push \
--force

View File

@@ -1,4 +1,4 @@
name: 'Build and Publish Images'
name: 'Build and Publish Images on a Schedule'
on:
workflow_dispatch:
schedule:

View File

@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
<!--
## [Unreleased]
### Added
* ci: force image build if source changes in main
### Fixed
### Changed
### Removed