Handle global expressions (#71)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-05-07 21:53:30 +02:00
committed by GitHub
parent e09df4df3c
commit 5e6d5157fb
4 changed files with 195 additions and 212 deletions

View File

@ -38,6 +38,7 @@ ___
* [`type=sha`](#typesha)
* [Notes](#notes)
* [Latest tag](#latest-tag)
* [Global expressions](#global-expressions)
* [Overwrite labels](#overwrite-labels)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [Contributing](#contributing)
@ -554,6 +555,25 @@ tags: |
* [`type=semver,pattern=...`](#typesemver)
* [`type=match,pattern=...`](#typematch)
### Global expressions
The following [Handlebars template](https://handlebarsjs.com/guide/) expressions for `prefix`, `suffix` and `value`
attributes are available:
| Expression | Output |
|--------------------------|----------------------|
| `{{branch}}` | `master` |
| `{{tag}}` | `v1.2.3` |
| `{{sha}}` | `90dd603` |
```yaml
tags: |
# dynamically set the branch name as a prefix
type=sha,prefix={{branch}}-
# dynamically set the branch name and sha as a custom tag
type=raw,value=mytag-{{branch}}-{{sha}}
```
### Overwrite labels
If some of the [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)