Skip to content

Commit b85b590

Browse files
authored
Merge pull request #93 from nunit/issue-91
Fix error in versioning
2 parents 083dde7 + 07784f3 commit b85b590

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

recipe/versioning.cake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,30 @@ public class BuildVersion
8686
if (label == branchName)
8787
label = "ci";
8888

89+
string suffix = "-" + label;
90+
8991
switch (label)
9092
{
9193
case "ci":
9294
branchName = Regex.Replace(branchName, "[^0-9A-Za-z-]+", "-");
93-
string suffix = $"-ci{_gitVersion.CommitsSinceVersionSourcePadded}-{branchName}";
94-
// Nuget limits "special version part" to 20 chars. Add one for the hyphen.
95-
if (suffix.Length > 21)
96-
suffix = suffix.Substring(0, 21);
97-
return _gitVersion.MajorMinorPatch + suffix;
98-
95+
suffix += _gitVersion.CommitsSinceVersionSourcePadded + "-" + branchName;
96+
break;
9997
case "dev":
10098
case "pre":
10199
case "pr":
100+
suffix += "." + _gitVersion.PreReleaseNumber;
101+
break;
102102
case "rc":
103103
case "alpha":
104104
case "beta":
105105
default:
106-
return _gitVersion.SemVer;
106+
suffix += "." + _gitVersion.CommitsSinceVersionSource;
107+
break;
107108
}
109+
110+
// Nuget limits "special version part" to 20 chars. Add one for the hyphen.
111+
if (suffix.Length > 21)
112+
suffix = suffix.Substring(0, 21);
113+
return _gitVersion.MajorMinorPatch + suffix;
108114
}
109115
}

0 commit comments

Comments
 (0)