mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-25 13:39:33 +01:00
Generate latest tag by default on push tag event (#5)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
5ecce77816
commit
6cc07472c0
4 changed files with 25 additions and 13 deletions
16
README.md
16
README.md
|
@ -23,6 +23,7 @@ ___
|
|||
* [inputs](#inputs)
|
||||
* [outputs](#outputs)
|
||||
* [Notes](#notes)
|
||||
* [Latest tag](#latest-tag)
|
||||
* [`tag-match` examples](#tag-match-examples)
|
||||
* [Schedule tag](#schedule-tag)
|
||||
* [Overwrite labels](#overwrite-labels)
|
||||
|
@ -42,10 +43,9 @@ ___
|
|||
|-----------------|-------------------------------|------------|-------------------------------------|
|
||||
| `schedule` | `refs/heads/master` | `45f132a` | `sha-45f132a`, `nightly` |
|
||||
| `pull_request` | `refs/pull/2/merge` | `a123b57` | `sha-a123b57`, `pr-2` |
|
||||
| `push` | `refs/heads/<default_branch>` | `676cae2` | `sha-676cae2`, `edge` |
|
||||
| `push` | `refs/heads/dev` | `cf20257` | `sha-cf20257`, `dev` |
|
||||
| `push` | `refs/heads/master` | `cf20257` | `sha-cf20257`, `master` |
|
||||
| `push` | `refs/heads/my/branch` | `a5df687` | `sha-a5df687`, `my-branch` |
|
||||
| `push tag` | `refs/tags/v1.2.3` | `bf4565b` | `sha-bf4565b`, `1.2.3`, `latest` |
|
||||
| `push tag` | `refs/tags/v1.2.3` | `bf4565b` | `sha-bf4565b`, `v1.2.3`, `latest` |
|
||||
| `push tag` | `refs/tags/mytag` | `afb7833` | `sha-afb7833`, `mytag` |
|
||||
|
||||
## Usage
|
||||
|
@ -76,10 +76,6 @@ jobs:
|
|||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
with:
|
||||
images: name/app
|
||||
tag-sha: true
|
||||
tag-edge: true
|
||||
tag-match: 'v(.*)'
|
||||
tag-match-group: '1'
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
@ -138,6 +134,12 @@ Following outputs are available
|
|||
|
||||
## Notes
|
||||
|
||||
### Latest tag
|
||||
|
||||
Latest Docker tag will be generated by default on `push tag` event. So if for example you push the `v1.2.3` Git tag,
|
||||
you will have at the output of this action the Docker tags `v1.2.3` and `latest`. But you can allow the latest tag to be
|
||||
generated only if the Git tag matches a regular expression with the [`tag-match` input](#tag-match-examples).
|
||||
|
||||
### `tag-match` examples
|
||||
|
||||
| Git tag | `tag-match` | `tag-match-group` | Docker tag
|
||||
|
|
|
@ -377,10 +377,11 @@ describe('push tag', () => {
|
|||
} as Inputs,
|
||||
{
|
||||
version: 'release1',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:release1'
|
||||
'user/app:release1',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
|
@ -400,10 +401,11 @@ describe('push tag', () => {
|
|||
} as Inputs,
|
||||
{
|
||||
version: '20200110-RC2',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:20200110-RC2'
|
||||
'user/app:20200110-RC2',
|
||||
'user/app:latest'
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
|
@ -686,11 +688,13 @@ describe('latest', () => {
|
|||
} as Inputs,
|
||||
{
|
||||
version: 'v1.1.1',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'org/app:v1.1.1',
|
||||
'org/app:latest',
|
||||
'ghcr.io/user/app:v1.1.1',
|
||||
'ghcr.io/user/app:latest',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
|
@ -951,10 +955,11 @@ describe('release', () => {
|
|||
} as Inputs,
|
||||
{
|
||||
version: 'v1.1.1',
|
||||
latest: false
|
||||
latest: true
|
||||
} as Version,
|
||||
[
|
||||
'user/app:v1.1.1',
|
||||
'user/app:latest',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
|
|
3
dist/index.js
generated
vendored
3
dist/index.js
generated
vendored
|
@ -208,6 +208,9 @@ class Meta {
|
|||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
}
|
||||
else {
|
||||
version.latest = true;
|
||||
}
|
||||
}
|
||||
else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||
|
|
|
@ -52,6 +52,8 @@ export class Meta {
|
|||
version.version = tagMatch[this.inputs.tagMatchGroup];
|
||||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
} else {
|
||||
version.latest = true;
|
||||
}
|
||||
} else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||
version.version = this.context.ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||
|
|
Loading…
Reference in a new issue