You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GitHub Action to extract metadata from Git reference and GitHub events.
9
-
This action is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action) action to tag and label Docker images.
8
+
GitHub Action to extract metadata from Git reference and GitHub events. This action
9
+
is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action)
10
+
action to tag and label Docker images.
10
11
11
12

12
13
@@ -33,6 +34,7 @@ ___
33
34
*[Notes](#notes)
34
35
*[Image name and tag sanitization](#image-name-and-tag-sanitization)
35
36
*[Latest tag](#latest-tag)
37
+
*[`priority` attribute](#priority-attribute)
36
38
*[Global expressions](#global-expressions)
37
39
*[`{{branch}}`](#branch)
38
40
*[`{{tag}}`](#tag)
@@ -43,7 +45,7 @@ ___
43
45
*[Major version zero](#major-version-zero)
44
46
*[JSON output object](#json-output-object)
45
47
*[Overwrite labels](#overwrite-labels)
46
-
*[Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
This action also handles a bake definition file that can be used with the
165
-
[Docker Bake action](https://github.com/docker/bake-action). You just have to declare an empty target named
166
-
`docker-metadata-action`and inherit from it.
169
+
[Docker Bake action](https://github.com/docker/bake-action). You just have to
170
+
declare an empty target named `docker-metadata-action` and inherit from it.
167
171
168
172
```hcl
169
173
// docker-bake.hcl
@@ -223,7 +227,8 @@ jobs:
223
227
targets: build
224
228
```
225
229
226
-
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with `refs/tags/v1.2.3` ref:
230
+
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with
231
+
`refs/tags/v1.2.3` ref:
227
232
228
233
```json
229
234
{
@@ -282,13 +287,13 @@ Following inputs can be used as `step.with` keys
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionally for `latest`
329
-
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionally for `latest`
333
+
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated
334
+
tag and optionally for `latest`
335
+
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated
336
+
tag and optionally for `latest`
330
337
331
338
## `tags` input
332
339
333
-
`tags`is the core input of this action as everything related to it will reflect the output metadata. This one is in
334
-
the form of a key-value pair list in CSV format to remove limitations intrinsically linked to GitHub Actions
340
+
`tags`is the core input of this action as everything related to it will
341
+
reflect the output metadata. This one is in the form of a key-value pair list
342
+
in CSV format to remove limitations intrinsically linked to GitHub Actions
335
343
(only string format is handled in the input fields). Here is an example:
336
344
337
345
```yaml
@@ -359,7 +367,7 @@ Each entry is defined by a `type`, which are:
359
367
And global attributes:
360
368
361
369
* `enable=<true|false>` enable this entry (default `true`)
362
-
* `priority=<number>` priority to manage the order of tags
370
+
* `priority=<number>` set tag [priority](#priority-attribute) order
363
371
* `prefix=<string>` add prefix
364
372
* `suffix=<string>` add suffix
365
373
@@ -385,10 +393,11 @@ tags: |
385
393
type=schedule,pattern={{date 'YYYYMMDD'}}
386
394
```
387
395
388
-
Will be used on [schedule event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule).
396
+
Will be used on [schedule event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule).
397
+
398
+
`pattern`is a specially crafted attribute to support [Handlebars' template](https://handlebarsjs.com/guide/)
399
+
with the following expressions:
389
400
390
-
`pattern`is a specially crafted attribute to support [Handlebars' template](https://handlebarsjs.com/guide/) with
391
-
the following expressions:
392
401
* `date 'format'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
393
402
394
403
| Pattern | Output |
@@ -413,11 +422,13 @@ tags: |
413
422
type=semver,pattern={{version}},value=v1.0.0
414
423
```
415
424
416
-
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
417
-
and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value`
418
-
attribute.
425
+
Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
426
+
and requires a valid [semver](https://semver.org/) Git tag, but you can also
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
421
432
* `raw` ; the actual tag
422
433
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
> *Pre-release (rc, beta, alpha) will only extend `{{version}}` (or `{{raw}}` if specified) as tag
440
-
> because they are updated frequently, and contain many breaking changes that are (by the author's design)
441
-
> not yet fit for public consumption.
450
+
> *Pre-release (rc, beta, alpha) will only extend `{{version}}` (or `{{raw}}`
451
+
> if specified) as tag because they are updated frequently, and contain many
452
+
> breaking changes that are (by the author's design) not yet fit for public
453
+
> consumption.
442
454
443
455
Extended attributes and default values:
444
456
@@ -457,11 +469,13 @@ tags: |
457
469
type=pep440,pattern={{version}},value=1.0.0
458
470
```
459
471
460
-
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
461
-
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/), but you can also use a
462
-
custom value through `value` attribute.
472
+
Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
473
+
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/),
474
+
but you can also use a custom value through `value` attribute.
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
465
479
* `raw` ; the actual tag
466
480
* `version` ; cleaned version
467
481
* `major` ; major version identifier
@@ -482,9 +496,10 @@ custom value through `value` attribute.
> *dev/pre/post release will only extend `{{version}}` (or `{{raw}}` if specified) as tag
486
-
> because they are updated frequently, and contain many breaking changes that are (by the author's design)
487
-
> not yet fit for public consumption.
499
+
> *dev/pre/post release will only extend `{{version}}` (or `{{raw}}` if
500
+
> specified) as tag because they are updated frequently, and contain many
501
+
> breaking changes that are (by the author's design) not yet fit for public
502
+
> consumption.
488
503
489
504
Extended attributes and default values:
490
505
@@ -505,9 +520,9 @@ tags: |
505
520
type=match,pattern=v(.*),group=1,value=v1.0.0
506
521
```
507
522
508
-
Can create a regular expression for matching Git tag with a pattern and capturing group. Will be used on a
509
-
[push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) but, you can also use
510
-
a custom value through `value` attribute.
523
+
Can create a regular expression for matching Git tag with a pattern and
524
+
capturing group. Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
525
+
but, you can also use a custom value through `value` attribute.
An `edge` tag reflects the last commit of the active branch on your Git repository. I usually prefer to use `edge`
538
-
as a Docker tag for a better distinction or common pattern. This is also used by official images
539
-
like [Alpine](https://hub.docker.com/_/alpine).
552
+
An `edge` tag reflects the last commit of the active branch on your Git
553
+
repository. I usually prefer to use `edge` as a Docker tag for a better
554
+
distinction or common pattern. This is also used by official images like [Alpine](https://hub.docker.com/_/alpine).
540
555
541
556
Extended attributes and default values:
542
557
@@ -558,17 +573,19 @@ tags: |
558
573
```
559
574
560
575
This type handles Git ref (or reference) for the following events:
In order to comply with [the specification](https://docs.docker.com/engine/reference/commandline/tag/#extended-description),
648
+
In order to comply with [the specification](https://docs.docker.com/engine/reference/commandline/tag/#description),
632
649
the image name components may contain lowercase letters, digits and separators.
633
650
A separator is defined as a period, one or two underscores, or one or more
634
651
dashes. A name component may not start or end with a separator.
@@ -644,7 +661,9 @@ To ease the integration in your workflow, this action will automatically:
644
661
645
662
### Latest tag
646
663
647
-
`latest`tag is handled through the [`flavor` input](#flavor-input). It will be generated by default (`auto` mode) for:
664
+
`latest`tag is handled through the [`flavor` input](#flavor-input). It will be
@@ -742,11 +779,11 @@ Returns the current date rendered by its [moment format](https://momentjs.com/do
742
779
743
780
### Major version zero
744
781
745
-
Major version zero (`0.y.z`) is for initial development and **may** change at any time. This means the public API
746
-
[**should not** be considered stable](https://semver.org/#spec-item-4).
782
+
Major version zero (`0.y.z`) is for initial development and **may** change at
783
+
any time. This means the public API [**should not** be considered stable](https://semver.org/#spec-item-4).
747
784
748
-
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver) with `{{major}}`
749
-
pattern. You can manage this behavior like this:
785
+
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver)
786
+
with `{{major}}` pattern. You can manage this behavior like this:
750
787
751
788
```yaml
752
789
# refs/tags/v0.1.2
@@ -761,8 +798,8 @@ tags: |
761
798
762
799
### JSON output object
763
800
764
-
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your
765
-
workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson):
801
+
The `json` output is a JSON object composed of the generated tags and labels so
802
+
that you can reuse them further in your workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson):
766
803
767
804
```yaml
768
805
-
@@ -802,18 +839,7 @@ labels generated are not suitable, you can overwrite them like this:
802
839
org.opencontainers.image.vendor=MyCompany
803
840
```
804
841
805
-
## Keep up-to-date with GitHub Dependabot
806
-
807
-
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
808
-
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
809
-
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
842
+
## Contributing
810
843
811
-
```yaml
812
-
version: 2
813
-
updates:
814
-
# Maintain dependencies for GitHub Actions
815
-
- package-ecosystem: "github-actions"
816
-
directory: "/"
817
-
schedule:
818
-
interval: "daily"
819
-
```
844
+
Want to contribute? Awesome! You can find information about contributing to
845
+
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
0 commit comments