This subaction generates a list of Bake targets that can be used in a GitHub matrix, so you can distribute your builds across multiple runners.
# docker-bake.hcl
group "validate" {
targets = ["lint", "doctoc"]
}
target "lint" {
target = "lint"
}
target "doctoc" {
target = "doctoc"
}
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v4
with:
target: validate
validate:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v5
with:
targets: ${{ matrix.target }}
Name | Type | Description |
---|---|---|
workdir |
String | Working directory to use (defaults to . ) |
files |
List/CSV | List of bake definition files |
target |
String | The target to use within the bake file |
The following outputs are available
Name | Type | Description |
---|---|---|
targets |
List/CSV | List of extracted targest |