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
Copy file name to clipboardExpand all lines: README.md
+72-68Lines changed: 72 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,9 @@
5
5
6
6
## About
7
7
8
-
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
@@ -44,7 +45,7 @@ ___
44
45
*[Major version zero](#major-version-zero)
45
46
*[JSON output object](#json-output-object)
46
47
*[Overwrite labels](#overwrite-labels)
47
-
*[Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
48
+
*[Contributing](#contributing)
48
49
49
50
## Usage
50
51
@@ -165,8 +166,8 @@ jobs:
165
166
### Bake definition
166
167
167
168
This action also handles a bake definition file that can be used with the
168
-
[Docker Bake action](https://github.com/docker/bake-action). You just have to declare an empty target named
169
-
`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.
170
171
171
172
```hcl
172
173
// docker-bake.hcl
@@ -226,7 +227,8 @@ jobs:
226
227
targets: build
227
228
```
228
229
229
-
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:
230
232
231
233
```json
232
234
{
@@ -285,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`
332
-
* `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`
333
337
334
338
## `tags` input
335
339
336
-
`tags`is the core input of this action as everything related to it will reflect the output metadata. This one is in
337
-
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
338
343
(only string format is handled in the input fields). Here is an example:
339
344
340
345
```yaml
@@ -388,10 +393,11 @@ tags: |
388
393
type=schedule,pattern={{date 'YYYYMMDD'}}
389
394
```
390
395
391
-
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:
392
400
393
-
`pattern`is a specially crafted attribute to support [Handlebars' template](https://handlebarsjs.com/guide/) with
394
-
the following expressions:
395
401
* `date 'format'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
396
402
397
403
| Pattern | Output |
@@ -416,11 +422,13 @@ tags: |
416
422
type=semver,pattern={{version}},value=v1.0.0
417
423
```
418
424
419
-
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
420
-
and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value`
421
-
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:
424
432
* `raw` ; the actual tag
425
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
443
-
> because they are updated frequently, and contain many breaking changes that are (by the author's design)
444
-
> 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.
445
454
446
455
Extended attributes and default values:
447
456
@@ -460,11 +469,13 @@ tags: |
460
469
type=pep440,pattern={{version}},value=1.0.0
461
470
```
462
471
463
-
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
464
-
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/), but you can also use a
465
-
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:
468
479
* `raw` ; the actual tag
469
480
* `version` ; cleaned version
470
481
* `major` ; major version identifier
@@ -485,9 +496,10 @@ custom value through `value` attribute.
> *dev/pre/post release will only extend `{{version}}` (or `{{raw}}` if specified) as tag
489
-
> because they are updated frequently, and contain many breaking changes that are (by the author's design)
490
-
> 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.
491
503
492
504
Extended attributes and default values:
493
505
@@ -508,9 +520,9 @@ tags: |
508
520
type=match,pattern=v(.*),group=1,value=v1.0.0
509
521
```
510
522
511
-
Can create a regular expression for matching Git tag with a pattern and capturing group. Will be used on a
512
-
[push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) but, you can also use
513
-
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`
541
-
as a Docker tag for a better distinction or common pattern. This is also used by official images
542
-
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).
543
555
544
556
Extended attributes and default values:
545
557
@@ -561,6 +573,7 @@ tags: |
561
573
```
562
574
563
575
This type handles Git ref (or reference) for the following events:
576
+
564
577
* `branch` ; eg. `refs/heads/master`
565
578
* `tag` ; eg. `refs/tags/v1.0.0`
566
579
* `pr` ; eg. `refs/pull/318/merge`
@@ -632,7 +645,7 @@ tags: |
632
645
633
646
### Image name and tag sanitization
634
647
635
-
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),
636
649
the image name components may contain lowercase letters, digits and separators.
637
650
A separator is defined as a period, one or two underscores, or one or more
638
651
dashes. A name component may not start or end with a separator.
@@ -648,7 +661,9 @@ To ease the integration in your workflow, this action will automatically:
648
661
649
662
### Latest tag
650
663
651
-
`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
665
+
generated by default (`auto` mode) for:
666
+
652
667
* [`type=ref,event=tag`](#typeref)
653
668
* [`type=semver,pattern=...`](#typesemver)
654
669
* [`type=match,pattern=...`](#typematch)
@@ -707,12 +722,12 @@ tags: |
707
722
Returns the branch name that triggered the workflow run. Will be empty if not
@@ -764,11 +779,11 @@ Returns the current date rendered by its [moment format](https://momentjs.com/do
764
779
765
780
### Major version zero
766
781
767
-
Major version zero (`0.y.z`) is for initial development and **may** change at any time. This means the public API
768
-
[**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).
769
784
770
-
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver) with `{{major}}`
771
-
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:
772
787
773
788
```yaml
774
789
# refs/tags/v0.1.2
@@ -783,8 +798,8 @@ tags: |
783
798
784
799
### JSON output object
785
800
786
-
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your
787
-
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):
788
803
789
804
```yaml
790
805
-
@@ -824,18 +839,7 @@ labels generated are not suitable, you can overwrite them like this:
824
839
org.opencontainers.image.vendor=MyCompany
825
840
```
826
841
827
-
## Keep up-to-date with GitHub Dependabot
828
-
829
-
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
830
-
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
831
-
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
842
+
## Contributing
832
843
833
-
```yaml
834
-
version: 2
835
-
updates:
836
-
# Maintain dependencies for GitHub Actions
837
-
- package-ecosystem: "github-actions"
838
-
directory: "/"
839
-
schedule:
840
-
interval: "daily"
841
-
```
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