Skip to content

Commit

Permalink
(cake-buildGH-569) Use GitReleaseManager to automate more processes
Browse files Browse the repository at this point in the history
- Add Assets to release
- Publish Relase
- Close associated Milestone in GitHub
  • Loading branch information
gep13 committed Feb 2, 2016
1 parent 255e4d9 commit 770e3b7
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ 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);
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
Expand Down Expand Up @@ -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,
Expand All @@ -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")
Expand Down

0 comments on commit 770e3b7

Please sign in to comment.