Skip to content

Commit ad6ed14

Browse files
committed
move list-targets docs to its own readme
Signed-off-by: CrazyMax <[email protected]>
1 parent 93ee8f4 commit ad6ed14

File tree

3 files changed

+86
-73
lines changed

3 files changed

+86
-73
lines changed

.github/subaction-list-targets.png

12.5 KB
Loading

README.md

+2-73
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ ___
2222
* [outputs](#outputs)
2323
* [environment variables](#environment-variables)
2424
* [Subactions](#subactions)
25-
* [`list-targets`](#list-targets)
26-
* [inputs](#inputs-1)
27-
* [outputs](#outputs-1)
25+
* [`list-targets`](subaction/list-targets)
2826
* [Contributing](#contributing)
2927

3028
## Usage
@@ -216,76 +214,7 @@ The following outputs are available
216214

217215
## Subactions
218216

219-
### `list-targets`
220-
221-
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),
222-
so you can distribute your builds across multiple runners.
223-
224-
```hcl
225-
# docker-bake.hcl
226-
group "validate" {
227-
targets = ["lint", "doctoc"]
228-
}
229-
230-
target "lint" {
231-
target = "lint"
232-
}
233-
234-
target "doctoc" {
235-
target = "doctoc"
236-
}
237-
```
238-
239-
```yaml
240-
jobs:
241-
prepare:
242-
runs-on: ubuntu-latest
243-
outputs:
244-
targets: ${{ steps.generate.outputs.targets }}
245-
steps:
246-
-
247-
name: Checkout
248-
uses: actions/checkout@v4
249-
-
250-
name: List targets
251-
id: generate
252-
uses: docker/bake-action/subaction/list-targets@v4
253-
with:
254-
target: validate
255-
256-
validate:
257-
runs-on: ubuntu-latest
258-
needs:
259-
- prepare
260-
strategy:
261-
fail-fast: false
262-
matrix:
263-
target: ${{ fromJson(needs.prepare.outputs.targets) }}
264-
steps:
265-
-
266-
name: Checkout
267-
uses: actions/checkout@v4
268-
-
269-
name: Validate
270-
uses: docker/bake-action@v5
271-
with:
272-
targets: ${{ matrix.target }}
273-
```
274-
#### inputs
275-
276-
| Name | Type | Description |
277-
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
278-
| `workdir` | String | Working directory to use (defaults to `.`) |
279-
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
280-
| `target` | String | The target to use within the bake file |
281-
282-
#### outputs
283-
284-
The following outputs are available
285-
286-
| Name | Type | Description |
287-
|------------|----------|----------------------------|
288-
| `targets` | List/CSV | List of extracted targest |
217+
* [`list-targets`](subaction/list-targets)
289218

290219
## Contributing
291220

subaction/list-targets/README.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## About
2+
3+
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),
4+
so you can distribute your builds across multiple runners.
5+
6+
![Screenshot](../../.github/bake-action.png)
7+
8+
___
9+
10+
* [Usage](#usage)
11+
* [Customizing](#customizing)
12+
* [inputs](#inputs)
13+
* [outputs](#outputs)
14+
15+
## Usage
16+
17+
```hcl
18+
# docker-bake.hcl
19+
group "validate" {
20+
targets = ["lint", "doctoc"]
21+
}
22+
23+
target "lint" {
24+
target = "lint"
25+
}
26+
27+
target "doctoc" {
28+
target = "doctoc"
29+
}
30+
```
31+
32+
```yaml
33+
jobs:
34+
prepare:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
targets: ${{ steps.generate.outputs.targets }}
38+
steps:
39+
-
40+
name: Checkout
41+
uses: actions/checkout@v4
42+
-
43+
name: List targets
44+
id: generate
45+
uses: docker/bake-action/subaction/list-targets@v4
46+
with:
47+
target: validate
48+
49+
validate:
50+
runs-on: ubuntu-latest
51+
needs:
52+
- prepare
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
target: ${{ fromJson(needs.prepare.outputs.targets) }}
57+
steps:
58+
-
59+
name: Checkout
60+
uses: actions/checkout@v4
61+
-
62+
name: Validate
63+
uses: docker/bake-action@v5
64+
with:
65+
targets: ${{ matrix.target }}
66+
```
67+
68+
## Customizing
69+
70+
### inputs
71+
72+
| Name | Type | Description |
73+
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
74+
| `workdir` | String | Working directory to use (defaults to `.`) |
75+
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
76+
| `target` | String | The target to use within the bake file |
77+
78+
### outputs
79+
80+
The following outputs are available
81+
82+
| Name | Type | Description |
83+
|------------|----------|----------------------------|
84+
| `targets` | List/CSV | List of extracted targest |

0 commit comments

Comments
 (0)