Skip to content

Commit 893d6e4

Browse files
committed
GH-1717 - Fix the version numbers for beta versions of GitVersion
1 parent 9bcbdb0 commit 893d6e4

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

build.cake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ Task("Pack-Nuget")
352352

353353
var nugetSettings = new NuGetPackSettings
354354
{
355-
Version = parameters.Version.SemVersion,
355+
Version = parameters.Version.NugetVersion,
356+
NoPackageAnalysis = true,
356357
OutputDirectory = parameters.Paths.Directories.NugetRoot,
357358
Files = GetFiles(artifactPath + "/**/*.*")
358359
.Select(file => new NuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") })

build/artifacts.cake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ public class BuildPackages
66

77
public static BuildPackages GetPackages(
88
DirectoryPath nugetRooPath,
9-
string semVersion,
9+
BuildVersion version,
1010
string[] packageIds,
1111
string[] chocolateyPackageIds)
1212
{
13-
var toNugetPackage = BuildPackage(nugetRooPath, semVersion);
14-
var toChocolateyPackage = BuildPackage(nugetRooPath, semVersion, isChocolateyPackage: true);
13+
var toNugetPackage = BuildPackage(nugetRooPath, version.NugetVersion);
14+
var toChocolateyPackage = BuildPackage(nugetRooPath, version.SemVersion, isChocolateyPackage: true);
1515
var nugetPackages = packageIds.Select(toNugetPackage).ToArray();
1616
var chocolateyPackages = chocolateyPackageIds.Select(toChocolateyPackage).ToArray();
1717

build/parameters.cake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public class BuildParameters
107107

108108
Packages = BuildPackages.GetPackages(
109109
Paths.Directories.NugetRoot,
110-
Version.SemVersion,
110+
Version,
111111
new [] { "GitVersion.CommandLine.DotNetCore", "GitVersion.CommandLine", "GitVersionCore", "GitVersionTask", "GitVersion.Tool" },
112112
new [] { "GitVersion.Portable" });
113113

@@ -139,8 +139,9 @@ public class BuildParameters
139139
var msBuildSettings = new DotNetCoreMSBuildSettings()
140140
.WithProperty("Version", version.SemVersion)
141141
.WithProperty("AssemblyVersion", version.Version)
142-
.WithProperty("PackageVersion", version.SemVersion)
143-
.WithProperty("FileVersion", version.Version);
142+
.WithProperty("PackageVersion", version.NugetVersion)
143+
.WithProperty("FileVersion", version.Version)
144+
.WithProperty("NoPackageAnalysis", "true");
144145

145146
if(!IsRunningOnWindows)
146147
{

build/version.cake

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@ public class BuildVersion
55
public string Milestone { get; private set; }
66
public string SemVersion { get; private set; }
77
public string GemVersion { get; private set; }
8+
public string NugetVersion { get; private set; }
89
public string VsixVersion { get; private set; }
910

1011
public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
1112
{
1213
var version = gitVersion.MajorMinorPatch;
1314
var semVersion = gitVersion.LegacySemVer;
15+
var nugetVersion = gitVersion.LegacySemVer;
1416
var vsixVersion = gitVersion.MajorMinorPatch;
1517

1618
if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) {
1719
semVersion += "-" + gitVersion.BuildMetaData;
20+
nugetVersion += "." + gitVersion.BuildMetaData;
1821
vsixVersion += "." + DateTime.UtcNow.ToString("yyMMddHHmm");
1922
}
2023

2124
return new BuildVersion
2225
{
23-
GitVersion = gitVersion,
24-
Milestone = version,
25-
Version = version,
26-
SemVersion = semVersion,
27-
GemVersion = semVersion.Replace("-", "."),
28-
VsixVersion = vsixVersion,
26+
GitVersion = gitVersion,
27+
Milestone = version,
28+
Version = version,
29+
SemVersion = semVersion,
30+
GemVersion = semVersion.Replace("-", "."),
31+
NugetVersion = nugetVersion,
32+
VsixVersion = vsixVersion,
2933
};
3034
}
3135
}

0 commit comments

Comments
 (0)