From 8d5a258acdbd6ac378a4aba8979fad2ef1126d79 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sun, 10 Jan 2016 15:56:31 +0000 Subject: [PATCH] (GH-569) Use GitReleaseManager to automate more processes - Add Assets to release - Publish Relase - Close associated Milestone in GitHub --- build.cake | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/build.cake b/build.cake index f7156c0756..cdf738eedb 100644 --- a/build.cake +++ b/build.cake @@ -24,6 +24,7 @@ var releaseNotes = ParseReleaseNotes("./ReleaseNotes.md"); var buildNumber = AppVeyor.Environment.Build.Number; var version = releaseNotes.Version.ToString(); var semVersion = local ? version : (version + string.Concat("-build-", buildNumber)); +var milestone = string.Concat("v", version); // Define directories. var buildDir = Directory("./src/Cake/bin") + Directory(configuration); @@ -31,6 +32,8 @@ var buildResultDir = Directory("./build") + Directory("v" + semVersion); var testResultsDir = buildResultDir + Directory("test-results"); var nugetRoot = buildResultDir + Directory("nuget"); var binDir = buildResultDir + Directory("bin"); +var userName = EnvironmentVariable("CAKE_GITHUB_USERNAME"); +var password = EnvironmentVariable("CAKE_GITHUB_PASSWORD"); /////////////////////////////////////////////////////////////////////////////// // SETUP / TEARDOWN @@ -323,13 +326,22 @@ Task("Publish-HomeBrew") Information("Hash for creating HomeBrew PullRequest: {0}", hash); }); +Task("Publish-GitHub-Release") + .Does(() => +{ + var packageFile = File("Cake-bin-v" + semVersion + ".zip"); + var packagePath = buildResultDir + packageFile; + + GitReleaseManagerAddAssets(userName, password, "cake-build", "cake", milestone, packagePath.ToString()); + + GitReleaseManagerPublish(userName, password, "cake-build", "cake", milestone); + + GitReleaseManagerClose(userName, password, "cake-build", "cake", milestone); +}); + Task("Create-Release-Notes") .Does(() => { - var userName = EnvironmentVariable("CAKE_GITHUB_USERNAME"); - var password = EnvironmentVariable("CAKE_GITHUB_PASSWORD"); - var milestone = string.Concat("v", version); - GitReleaseManagerCreate(userName, password, "cake-build", "cake", new GitReleaseManagerCreateSettings { Milestone = milestone, Name = milestone, @@ -352,7 +364,8 @@ Task("Default") Task("Publish") .IsDependentOn("Publish-NuGet") .IsDependentOn("Publish-Chocolatey") - .IsDependentOn("Publish-HomeBrew"); + .IsDependentOn("Publish-HomeBrew") + .IsDependentOn("Publish-GitHub-Release"); Task("AppVeyor") .IsDependentOn("Update-AppVeyor-Build-Number")