This commit is contained in:
CrazyMax 2021-03-27 12:47:35 +01:00
parent 19618bde61
commit b171e9c8ea
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 252 additions and 46 deletions

View file

@ -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;
}