Skip to content

Commit 7a9f020

Browse files
committed
Added a workflow that runs when a Dockerfile has changed in a PR
Signed-off-by: Roland Asmann <[email protected]>
1 parent 3fae7bd commit 7a9f020

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

.github/actions/build-docker-image/action.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ inputs:
1313
description: Labels to add to the image
1414
output:
1515
description: Controls what should be done with the image(s) after building
16-
required: true
1716
platforms:
1817
description: The platforms for which to build the image
1918
required: true
2019
tags:
2120
description: All tags for the image
22-
required: true
2321
target:
2422
description: Which stage in the Dockerfile to build
2523
required: true
@@ -35,8 +33,7 @@ runs:
3533
context: .
3634
file: ${{ inputs.dockerfile }}
3735
labels: ${{ inputs.labels }}
38-
outputs: type=${{ inputs.output }}
36+
outputs: ${{ inputs.output }}
3937
platforms: ${{ inputs.platforms }}
40-
push: ${{ inputs.action == 'push' }}
4138
tags: ${{ inputs.tags }}
4239
target: ${{ inputs.target }}

.github/actions/build-docker-images-generate-attach-sboms/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ runs:
5555
dockerfile: ${{ inputs.dockerfile }}
5656
docker-args: ${{ inputs.docker-args }}
5757
labels: ${{ steps.metadata.outputs.labels }}
58-
output: registry
58+
output: type=registry
5959
platforms: linux/amd64${{ inputs.build-arm == 'true' && ',linux/arm64' || '' }}
6060
tags: ${{ inputs.tags || steps.metadata.outputs.tags }}
6161
target: ${{ inputs.target }}

.github/actions/generate-attach-sbom/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030
with:
3131
dockerfile: ${{ inputs.dockerfile }}
3232
docker-args: ${{ inputs.docker-args }}
33-
output: docker,dest=${{ runner.temp }}/image.tar
33+
output: type=docker,dest=${{ runner.temp }}/image.tar
3434
platforms: ${{ inputs.platform }}
3535
tags: ${{ inputs.tag }}
3636
target: ${{ inputs.target }}

.github/workflows/build-image.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build image(s) on PR
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ci/images/Dockerfile.*
7+
8+
permissions: {}
9+
10+
jobs:
11+
image:
12+
if: github.repository == 'CycloneDX/cdxgen'
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
imagefile: ${{ github.event.head_commit.modified }}
17+
runner: [ubuntu-24.04, ubuntu-24.04-arm]
18+
include:
19+
- runner: ubuntu-24.04
20+
platform: linux/amd64
21+
- runner: ubtuntu-24.04-arm
22+
platform: linux/arm64
23+
runs-on: ${{ matrix.runner }}
24+
steps:
25+
- name: Build image
26+
if: ${{ contains(matrix.imagefile, 'Dockerfile') }}
27+
uses: ./.github/actions/build-docker-image
28+
with:
29+
dockerfile: ${{ matrix.imagefile }}
30+
platforms: ${{ matric.platform }}
31+
target: cdxgen

0 commit comments

Comments
 (0)