Skip to content

Commit f28b243

Browse files
authored
Merge pull request #231 from crazy-max/fix-readme
readme: fix environment variable block location
2 parents dbdf67d + ad6ed14 commit f28b243

File tree

3 files changed

+89
-74
lines changed

3 files changed

+89
-74
lines changed

.github/subaction-list-targets.png

12.5 KB
Loading

README.md

+5-74
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ___
2222
* [outputs](#outputs)
2323
* [environment variables](#environment-variables)
2424
* [Subactions](#subactions)
25-
* [`list-targets`](#list-targets)
25+
* [`list-targets`](subaction/list-targets)
2626
* [Contributing](#contributing)
2727

2828
## Usage
@@ -204,79 +204,6 @@ The following outputs are available
204204
|------------|------|-----------------------|
205205
| `metadata` | JSON | Build result metadata |
206206

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

282209
| Name | Type | Default | Description |
@@ -285,6 +212,10 @@ The following outputs are available
285212
| `DOCKER_BUILD_RECORD_UPLOAD` | Bool | `true` | If `false`, build record upload as [GitHub artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) is disabled |
286213
| `DOCKER_BUILD_RECORD_RETENTION_DAYS` | Number | | Duration after which build record artifact will expire in days. Defaults to repository/org [retention settings](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) if unset or `0` |
287214

215+
## Subactions
216+
217+
* [`list-targets`](subaction/list-targets)
218+
288219
## Contributing
289220

290221
Want to contribute? Awesome! You can find information about contributing to

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)