This commit is contained in:
CrazyMax
2021-03-27 12:47:35 +01:00
parent 19618bde61
commit b171e9c8ea
5 changed files with 252 additions and 46 deletions

29
dist/index.js generated vendored
View File

@ -365,7 +365,15 @@ 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: {
@ -475,18 +483,6 @@ class Meta {
}
return version;
}
procRef(version, tag) {
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;
}
procRefBranch(version, tag) {
if (!/^refs\/heads\//.test(this.context.ref)) {
return version;
@ -598,7 +594,7 @@ class Meta {
val = `${val}${tag.attrs['suffix']}`;
}
else if (this.flavor.suffix.length > 0) {
val = `${this.flavor.suffix}${val}`;
val = `${val}${this.flavor.suffix}`;
}
return val;
}
@ -738,7 +734,7 @@ function Parse(s) {
if (parts.length == 1) {
tag.attrs['value'] = parts[0].trim();
}
else if (parts.length == 2) {
else {
const key = parts[0].trim().toLowerCase();
const value = parts[1].trim();
switch (key) {
@ -755,9 +751,6 @@ function Parse(s) {
}
}
}
else {
throw new Error(`Invalid entry: ${field}`);
}
}
if (tag.type == undefined) {
tag.type = Type.Raw;