mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-25 13:39:33 +01:00
Handle tag-match-latest on Git tag event (#8)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
b4c9b2116e
commit
52c4b1ad0c
5 changed files with 29 additions and 4 deletions
|
@ -114,7 +114,7 @@ Following inputs can be used as `step.with` keys
|
|||
| `tag-edge-branch` | String | Branch that will be tagged as edge (default `repo.default_branch`) |
|
||||
| `tag-match` | String | RegExp to match against a Git tag and use first match as Docker tag |
|
||||
| `tag-match-group` | Number | Group to get if `tag-match` matches (default `0`) |
|
||||
| `tag-match-latest` | Bool | Set `latest` Docker tag if `tag-match` matches (default `true`) |
|
||||
| `tag-match-latest` | Bool | Set `latest` Docker tag if `tag-match` matches or on Git tag event (default `true`) |
|
||||
| `tag-schedule` | String | [Template](#schedule-tag) to apply to schedule tag (default `nightly`) |
|
||||
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
||||
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
||||
|
|
|
@ -734,6 +734,31 @@ describe('latest', () => {
|
|||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
[
|
||||
'event_tag_v1.1.1.env',
|
||||
{
|
||||
images: ['org/app', 'ghcr.io/user/app'],
|
||||
tagMatchLatest: false,
|
||||
} as Inputs,
|
||||
{
|
||||
version: 'v1.1.1',
|
||||
latest: false
|
||||
} as Version,
|
||||
[
|
||||
'org/app:v1.1.1',
|
||||
'ghcr.io/user/app:v1.1.1',
|
||||
],
|
||||
[
|
||||
"org.opencontainers.image.title=Hello-World",
|
||||
"org.opencontainers.image.description=This your first repo!",
|
||||
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||
"org.opencontainers.image.source=https://github.com/octocat/Hello-World.git",
|
||||
"org.opencontainers.image.version=v1.1.1",
|
||||
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||
"org.opencontainers.image.licenses=MIT"
|
||||
]
|
||||
],
|
||||
])('given %p event ', tagsLabelsTest);
|
||||
});
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ inputs:
|
|||
default: '0'
|
||||
required: false
|
||||
tag-match-latest:
|
||||
description: 'Set latest Docker tag if tag-match matches'
|
||||
description: 'Set latest Docker tag if tag-match matches or on Git tag event'
|
||||
default: 'true'
|
||||
required: false
|
||||
tag-schedule:
|
||||
|
|
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
|
@ -209,7 +209,7 @@ class Meta {
|
|||
}
|
||||
}
|
||||
else {
|
||||
version.latest = true;
|
||||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
}
|
||||
else if (/^refs\/heads\//.test(this.context.ref)) {
|
||||
|
|
|
@ -53,7 +53,7 @@ export class Meta {
|
|||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
} else {
|
||||
version.latest = true;
|
||||
version.latest = this.inputs.tagMatchLatest;
|
||||
}
|
||||
} 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