Skip to content

Commit 24924b6

Browse files
committed
move metadata template examples to notes section
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 2de279e commit 24924b6

1 file changed

Lines changed: 34 additions & 43 deletions

File tree

README.md

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ___
1818
* [Outputs](#outputs-1)
1919
* [Notes](#notes)
2020
* [Runner mapping](#runner-mapping)
21+
* [Metadata templates](#metadata-templates)
2122

2223
## Overview
2324

@@ -233,29 +234,6 @@ jobs:
233234
| `meta-tags` | List | | [List of tags](https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input) as key-value pair attributes |
234235
| `meta-flavor` | List | | [Flavor](https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input) defines a global behavior for `meta-tags` |
235236

236-
> [!TIP]
237-
> When `output=image`, following inputs support Handlebars templates rendered
238-
> from selected `docker/metadata-action` outputs:
239-
> - `annotations`
240-
> - `build-args`
241-
> - `labels`
242-
>
243-
> The template context is exposed as `meta` with:
244-
> - `meta.version`
245-
> - `meta.tags`
246-
>
247-
> Example:
248-
> ```yaml
249-
> jobs:
250-
> build:
251-
> uses: docker/github-builder/.github/workflows/build.yml@v1
252-
> with:
253-
> output: image
254-
> build-args: |
255-
> VERSION={{meta.version}}
256-
> meta-images: name/app
257-
> ```
258-
259237
### Secrets
260238

261239
| Name | Default | Description |
@@ -365,26 +343,6 @@ jobs:
365343
| `meta-annotations` | List | | [List of custom annotations](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) |
366344
| `meta-flavor` | List | | [Flavor](https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input) defines a global behavior for `meta-tags` |
367345

368-
> [!TIP]
369-
> When `output=image`, the `set` input supports Handlebars templates rendered
370-
> from selected `docker/metadata-action` outputs.
371-
>
372-
> The template context is exposed as `meta` with:
373-
> - `meta.version`
374-
> - `meta.tags`
375-
>
376-
> Example:
377-
> ```yaml
378-
> jobs:
379-
> bake:
380-
> uses: docker/github-builder/.github/workflows/bake.yml@v1
381-
> with:
382-
> output: image
383-
> set: |
384-
> *.args.VERSION={{meta.version}}
385-
> meta-images: name/app
386-
> ```
387-
388346
### Secrets
389347

390348
| Name | Default | Description |
@@ -440,3 +398,36 @@ runner: |
440398

441399
For example, `linux` matches all Linux platforms, `linux/arm` matches variants
442400
such as `linux/arm/v7`, and `linux/arm64` is separate from `linux/arm`.
401+
402+
### Metadata templates
403+
404+
When `output=image`, some inputs support Handlebars templates rendered from
405+
selected `docker/metadata-action` outputs. The template context is exposed as
406+
`meta` with `meta.version` and `meta.tags`.
407+
408+
For the build workflow, the `annotations`, `build-args`, and `labels` inputs
409+
support metadata templates:
410+
411+
```yaml
412+
jobs:
413+
build:
414+
uses: docker/github-builder/.github/workflows/build.yml@v1
415+
with:
416+
output: image
417+
build-args: |
418+
VERSION={{meta.version}}
419+
meta-images: name/app
420+
```
421+
422+
For the bake workflow, the `set` input supports metadata templates:
423+
424+
```yaml
425+
jobs:
426+
bake:
427+
uses: docker/github-builder/.github/workflows/bake.yml@v1
428+
with:
429+
output: image
430+
set: |
431+
*.args.VERSION={{meta.version}}
432+
meta-images: name/app
433+
```

0 commit comments

Comments
 (0)