mirror of
https://github.com/docker/bake-action.git
synced 2025-07-14 12:41:53 +02:00
move list-targets docs to its own readme
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
BIN
.github/subaction-list-targets.png
vendored
Normal file
BIN
.github/subaction-list-targets.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
75
README.md
75
README.md
@ -22,9 +22,7 @@ ___
|
||||
* [outputs](#outputs)
|
||||
* [environment variables](#environment-variables)
|
||||
* [Subactions](#subactions)
|
||||
* [`list-targets`](#list-targets)
|
||||
* [inputs](#inputs-1)
|
||||
* [outputs](#outputs-1)
|
||||
* [`list-targets`](subaction/list-targets)
|
||||
* [Contributing](#contributing)
|
||||
|
||||
## Usage
|
||||
@ -216,76 +214,7 @@ The following outputs are available
|
||||
|
||||
## Subactions
|
||||
|
||||
### `list-targets`
|
||||
|
||||
This subaction generates a list of Bake targets that can be used in a [GitHub matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix),
|
||||
so you can distribute your builds across multiple runners.
|
||||
|
||||
```hcl
|
||||
# docker-bake.hcl
|
||||
group "validate" {
|
||||
targets = ["lint", "doctoc"]
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
target = "lint"
|
||||
}
|
||||
|
||||
target "doctoc" {
|
||||
target = "doctoc"
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
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 }}
|
||||
```
|
||||
#### inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `workdir` | String | Working directory to use (defaults to `.`) |
|
||||
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||
| `target` | String | The target to use within the bake file |
|
||||
|
||||
#### outputs
|
||||
|
||||
The following outputs are available
|
||||
|
||||
| Name | Type | Description |
|
||||
|------------|----------|----------------------------|
|
||||
| `targets` | List/CSV | List of extracted targest |
|
||||
* [`list-targets`](subaction/list-targets)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
84
subaction/list-targets/README.md
Normal file
84
subaction/list-targets/README.md
Normal file
@ -0,0 +1,84 @@
|
||||
## About
|
||||
|
||||
This subaction generates a list of Bake targets that can be used in a [GitHub matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix),
|
||||
so you can distribute your builds across multiple runners.
|
||||
|
||||

|
||||
|
||||
___
|
||||
|
||||
* [Usage](#usage)
|
||||
* [Customizing](#customizing)
|
||||
* [inputs](#inputs)
|
||||
* [outputs](#outputs)
|
||||
|
||||
## Usage
|
||||
|
||||
```hcl
|
||||
# docker-bake.hcl
|
||||
group "validate" {
|
||||
targets = ["lint", "doctoc"]
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
target = "lint"
|
||||
}
|
||||
|
||||
target "doctoc" {
|
||||
target = "doctoc"
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
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 }}
|
||||
```
|
||||
|
||||
## Customizing
|
||||
|
||||
### inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `workdir` | String | Working directory to use (defaults to `.`) |
|
||||
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||
| `target` | String | The target to use within the bake file |
|
||||
|
||||
### outputs
|
||||
|
||||
The following outputs are available
|
||||
|
||||
| Name | Type | Description |
|
||||
|------------|----------|----------------------------|
|
||||
| `targets` | List/CSV | List of extracted targest |
|
Reference in New Issue
Block a user