Skip to content

Commit 32b9434

Browse files
authored
Merge pull request #1074 from nunit/issue-1072
Code to perform a production release on GitHub
2 parents 84f4a2e + b0bca52 commit 32b9434

File tree

5 files changed

+41
-11
lines changed

5 files changed

+41
-11
lines changed

build.cake

+33-4
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ Task("PublishToMyGet")
484484
.Description("Publish packages to MyGet")
485485
.Does(() =>
486486
{
487-
if (!ShouldPublishToMyGet())
487+
if (!ShouldPublishToMyGet)
488488
Information("Nothing to publish to MyGet from this run.");
489489
else
490490
{
@@ -516,7 +516,7 @@ Task("PublishToNuGet")
516516
.Description("Publish packages to NuGet")
517517
.Does(() =>
518518
{
519-
if (!ShouldPublishToNuGet())
519+
if (!ShouldPublishToNuGet)
520520
Information("Nothing to publish to NuGet from this run.");
521521
else
522522
{
@@ -541,7 +541,7 @@ Task("PublishToChocolatey")
541541
.Description("Publish packages to Chocolatey")
542542
.Does(() =>
543543
{
544-
if (!ShouldPublishToChocolatey())
544+
if (!ShouldPublishToChocolatey)
545545
Information("Nothing to publish to Chocolatey from this run.");
546546
else
547547
{
@@ -611,6 +611,34 @@ Task("CreateDraftRelease")
611611
}
612612
});
613613

614+
//////////////////////////////////////////////////////////////////////
615+
// CREATE A PRODUCTION RELEASE
616+
//////////////////////////////////////////////////////////////////////
617+
618+
Task("CreateProductionRelease")
619+
.Does(() =>
620+
{
621+
if (IsProductionRelease)
622+
{
623+
string token = EnvironmentVariable(GITHUB_ACCESS_TOKEN);
624+
string tagName = ProductVersion;
625+
626+
var assetList = new List<string>();
627+
foreach (var package in AllPackages)
628+
assetList.Add(PACKAGE_DIR + package.PackageName);
629+
string assets = $"\"{string.Join(',', assetList.ToArray())}\"";
630+
631+
Information($"Publishing release {tagName} to GitHub");
632+
633+
GitReleaseManagerAddAssets(token, GITHUB_OWNER, GITHUB_REPO, tagName, assets);
634+
GitReleaseManagerClose(token, GITHUB_OWNER, GITHUB_REPO, tagName);
635+
}
636+
else
637+
{
638+
Information("Skipping CreateProductionRelease because this is not a production release");
639+
}
640+
});
641+
614642
//////////////////////////////////////////////////////////////////////
615643
// TASK TARGETS
616644
//////////////////////////////////////////////////////////////////////
@@ -655,7 +683,8 @@ Task("Appveyor")
655683
.Description("Target we run in our AppVeyor CI")
656684
.IsDependentOn("BuildTestAndPackage")
657685
.IsDependentOn("PublishPackages")
658-
.IsDependentOn("CreateDraftRelease");
686+
.IsDependentOn("CreateDraftRelease")
687+
.IsDependentOn("CreateProductionRelease");
659688

660689
Task("Default")
661690
.Description("Builds the engine and console runner")

cake/utilities.cake

+5-4
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ private void CheckPackageExists(FilePath package)
253253
$"Package not found: {package.GetFilename()}.\nCode may have changed since package was last built.");
254254
}
255255

256-
public bool IsPreRelease() => !string.IsNullOrEmpty(PreReleaseLabel);
256+
public bool IsPreRelease => !string.IsNullOrEmpty(PreReleaseLabel);
257257

258-
public bool ShouldPublishToMyGet() => IsPreRelease() && LABELS_WE_PUBLISH_ON_MYGET.Contains(PreReleaseLabel);
259-
public bool ShouldPublishToNuGet() => !IsPreRelease() || LABELS_WE_PUBLISH_ON_NUGET.Contains(PreReleaseLabel);
260-
public bool ShouldPublishToChocolatey() => !IsPreRelease() || LABELS_WE_PUBLISH_ON_CHOCOLATEY.Contains(PreReleaseLabel);
258+
public bool ShouldPublishToMyGet => IsPreRelease && LABELS_WE_PUBLISH_ON_MYGET.Contains(PreReleaseLabel);
259+
public bool ShouldPublishToNuGet => !IsPreRelease || LABELS_WE_PUBLISH_ON_NUGET.Contains(PreReleaseLabel);
260+
public bool ShouldPublishToChocolatey => !IsPreRelease || LABELS_WE_PUBLISH_ON_CHOCOLATEY.Contains(PreReleaseLabel);
261+
public bool IsProductionRelease => !IsPreRelease || LABELS_WE_RELEASE_ON_GITHUB.Contains(PreReleaseLabel);

src/NUnitConsole/ConsoleVersion.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[assembly: AssemblyProduct("NUnit Console Runner")]
66
[assembly: AssemblyVersion("3.14.0")]
7-
[assembly: AssemblyInformationalVersion("3.14.0-ci00038-issue-1070")]
7+
[assembly: AssemblyInformationalVersion("3.14.0-ci00040-issue-1072")]

src/NUnitEngine/EngineApiVersion.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
[assembly: AssemblyProduct("NUnit Engine API")]
66
[assembly: AssemblyVersion("3.0.0.0")]
7-
[assembly: AssemblyInformationalVersion("3.14.0-ci00038-issue-1070")]
7+
[assembly: AssemblyInformationalVersion("3.14.0-ci00040-issue-1072")]
88
[assembly: AssemblyFileVersion("3.13.0")]

src/NUnitEngine/EngineVersion.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[assembly: AssemblyProduct("NUnit Engine")]
66
[assembly: AssemblyVersion("3.14.0")]
7-
[assembly: AssemblyInformationalVersion("3.14.0-ci00038-issue-1070")]
7+
[assembly: AssemblyInformationalVersion("3.14.0-ci00040-issue-1072")]

0 commit comments

Comments
 (0)