Skip to content

Commit 637e12e

Browse files
committed
ci: enhance bake_targets.yml reusable workflow
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
1 parent 5de9468 commit 637e12e

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/bake_targets.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ on:
1212
description: "The PostgreSQL major version to bake"
1313
required: true
1414
type: string
15+
target:
16+
description: "The bake target to build"
17+
required: false
18+
default: "default"
19+
type: string
20+
bake_files:
21+
description: "A comma separated list of bake files to use"
22+
required: false
23+
type: string
24+
default: "./docker-bake.hcl"
25+
bake_remote_source:
26+
description: "The source repository for a remote bake definition"
27+
required: false
28+
type: string
1529

1630
permissions: {}
1731

@@ -32,11 +46,22 @@ jobs:
3246
- name: Checkout Code
3347
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3448

49+
# bake-action/subaction/matrix doesn't support remote bake files.
50+
# As a workaround, we clone the repository to allow passing the path to a local file.
51+
- name: Checkout code
52+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
53+
if: ${{ inputs.bake_remote_source != '' }}
54+
with:
55+
repository: ${{ inputs.bake_remote_source }}
56+
ref: main
57+
path: source
58+
3559
- name: List targets
3660
id: targets
3761
uses: docker/bake-action/subaction/matrix@3acf805d94d93a86cce4ca44798a76464a75b88c # v6
3862
with:
39-
target: "default"
63+
target: ${{ inputs.target }}
64+
files: ${{ inputs.bake_files }}
4065

4166
- name: Filter by versions
4267
id: extract_targets
@@ -74,6 +99,7 @@ jobs:
7499
revision: ${{ github.sha }}
75100
with:
76101
push: true
102+
files: ${{ inputs.bake_files }}
77103
targets: ${{ steps.extract_targets.outputs.filtered_targets }}
78104

79105
# Get a list of the images that were built and pushed. We only care about a single tag for each image.

0 commit comments

Comments
 (0)