Do not rebuild image if Dockerfile wasn't changed

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2024-10-24 17:20:34 +03:00
parent e8ca14a77b
commit 0d799a31d9

View file

@ -13,13 +13,29 @@ jobs:
tag: tag:
- openjdk-11-maven-3.8.6 - openjdk-11-maven-3.8.6
steps: steps:
- uses: actions/checkout@v3 - name: Clone git repo
with: uses: actions/checkout@v3
fetch-depth: 0
- run: apt update; apt install -y buildah - name: List modified files
- run: make ${{matrix.tag}} uses: tj-actions/changed-files@v45
- run: make ${{matrix.tag}} PUSH=y with:
if: github.ref == 'refs/heads/master' && github.event_name == 'push' files: |
${{matrix.tag}}/**
id: changed
- name: Install Buildah
run: apt update; apt install -y buildah
if: steps.changed.outputs.any_changed == 'true'
- name: Build OCI image
run: make ${{matrix.tag}}
if: steps.changed.outputs.any_changed == 'true'
- name: Push image to OCI registry
run: make ${{matrix.tag}} PUSH=y
if: >-
steps.changed.outputs.any_changed == 'true'
&& github.ref == 'refs/heads/master'
&& github.event_name == 'push'
env: env:
REGISTRY_PASSWORD: ${secrets.REGISTRY_PASSWORD} REGISTRY_PASSWORD: ${secrets.REGISTRY_PASSWORD}