mirror of
https://github.com/docker/metadata-action.git
synced 2026-01-22 06:28:56 +08:00
Allow custom value for semver and match type
This commit is contained in:
parent
b171e9c8ea
commit
e59258b94d
7 changed files with 179 additions and 20 deletions
20
src/meta.ts
20
src/meta.ts
|
|
@ -115,10 +115,16 @@ export class Meta {
|
|||
}
|
||||
|
||||
private procSemver(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref)) {
|
||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||
return version;
|
||||
}
|
||||
let vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
|
||||
let vraw: string;
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = tag.attrs['value'];
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
}
|
||||
if (!semver.valid(vraw)) {
|
||||
core.warning(`${vraw} is not a valid semver. More info: https://semver.org/`);
|
||||
return version;
|
||||
|
|
@ -152,10 +158,16 @@ export class Meta {
|
|||
}
|
||||
|
||||
private procMatch(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/tags\//.test(this.context.ref)) {
|
||||
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
|
||||
return version;
|
||||
}
|
||||
let vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
|
||||
let vraw: string;
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = tag.attrs['value'];
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
}
|
||||
|
||||
let latest: boolean = false;
|
||||
let tmatch;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue