mirror of
https://github.com/docker/metadata-action.git
synced 2026-01-22 06:28:56 +08:00
Tests
This commit is contained in:
parent
19618bde61
commit
b171e9c8ea
5 changed files with 252 additions and 46 deletions
21
src/meta.ts
21
src/meta.ts
|
|
@ -58,7 +58,13 @@ export class Meta {
|
|||
break;
|
||||
}
|
||||
case tcl.Type.Ref: {
|
||||
version = this.procRef(version, tag);
|
||||
if (tag.attrs['event'] == tcl.RefEvent.Branch) {
|
||||
version = this.procRefBranch(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.Tag) {
|
||||
version = this.procRefTag(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.PR) {
|
||||
version = this.procRefPr(version, tag);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case tcl.Type.Edge: {
|
||||
|
|
@ -176,17 +182,6 @@ export class Meta {
|
|||
return version;
|
||||
}
|
||||
|
||||
private procRef(version: Version, tag: tcl.Tag): Version {
|
||||
if (tag.attrs['event'] == tcl.RefEvent.Branch) {
|
||||
return this.procRefBranch(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.Tag) {
|
||||
return this.procRefTag(version, tag);
|
||||
} else if (tag.attrs['event'] == tcl.RefEvent.PR) {
|
||||
return this.procRefPr(version, tag);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
private procRefBranch(version: Version, tag: tcl.Tag): Version {
|
||||
if (!/^refs\/heads\//.test(this.context.ref)) {
|
||||
return version;
|
||||
|
|
@ -308,7 +303,7 @@ export class Meta {
|
|||
if (tag.attrs['suffix'].length > 0) {
|
||||
val = `${val}${tag.attrs['suffix']}`;
|
||||
} else if (this.flavor.suffix.length > 0) {
|
||||
val = `${this.flavor.suffix}${val}`;
|
||||
val = `${val}${this.flavor.suffix}`;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue