Handling the release note and the tagging

...and other stuff to finalize!
This commit is contained in:
Philippe Miossec
2016-11-02 19:52:08 +01:00
parent 2c850e159c
commit c5303b6ed0
6 changed files with 65 additions and 22 deletions
+2
View File
@@ -1,3 +1,5 @@
//Github user name (to be able to create the release tag)
GitHubUserAccount=[Place Holder... Replace this place holder by your github username!]
//GitHub personal token. You can create one at https://github.com/settings/tokens (Add at least the scope 'repo' or 'public_repo')
GitHub=[Place Holder... Replace this place holder by your personal token!]
//Chocolatey token. Get it from you Chocolatey account https://chocolatey.org/account
+4 -7
View File
@@ -164,14 +164,11 @@ And depending of the version of TFS you use :
git clone git://github.com/git-tfs/git-tfs.git
cd git-tfs
#building with MSBuild (with the default configuration: debug)
msbuild GitTfs.sln
#building with Cake (in a powershell console). It will also run the unit tests ;)
.\build.ps1
#or building with MSBuild in release
msbuild GitTfs.sln /p:Configuration=release
#or with Rake (Ruby)
rake build:debug
#help on the different targets
.\build.ps1 -Target "Help"
**Note:** if the build fails because you don't have all the `Visual Studio SDK`, just unload in Visual Studio all the projects you are not interested in to be able to build and use your own version.
You could also install, the Team Foundation Server Object Model for [Tfs 2010](https://visualstudiogallery.msdn.microsoft.com/a37e19fb-3052-4fc9-bef7-4a4682069a75) ([chocolatey](https://chocolatey.org/packages/tfs2010objectmodel)), [Tfs 2012](https://visualstudiogallery.msdn.microsoft.com/f30e5cc7-036e-449c-a541-d522299445aa) ([chocolatey](https://chocolatey.org/packages/tfs2012objectmodel)) and [Tfs 2013](https://visualstudiogallery.msdn.microsoft.com/3278bfa7-64a7-4a75-b0da-ec4ccb8d21b6) ([chocolatey](https://chocolatey.org/packages/tfs2013objectmodel)).
+6 -2
View File
@@ -14,12 +14,16 @@ build_script:
if($env:target -eq $null)
{
$target = "AppVeyorBuild"
echo "target: $target"
.\build.ps1 -Target "$target" -ScriptArgs '-isDryRun=true -gitHubUserAccount"$env:gitHubUserAccount" -gitHubToken="$env:gitHubToken" -chocolateyToken="$env:chocolateyToken"'
#$UseDryRun = "false"
}
else
{
$target = $env:target
echo "target: $target"
.\build.ps1 -Target "$target" -ScriptArgs '-isDryRun=false -gitHubUserAccount"$env:gitHubUserAccount" -gitHubToken="$env:gitHubToken" -chocolateyToken="$env:chocolateyToken"'
#$UseDryRun = "true"
}
echo "target: $target"
.\build.ps1 -Target "$target" -ScriptArgs '-gitHubToken="$env:gitHubToken" -chocolateyToken="$env:chocolateyToken"'
test: off
+51 -13
View File
@@ -1,6 +1,7 @@
//Don't define #tool here. Just add there to 'paket.dependencies' 'build' group
//Don't use #addin here. Use #r to load the dll found in the nuget package.
#r "./build/Octokit.dll" //Use our custom version because offical one has a http request timeout of 100s preventing upload of github release asset :( https://github.com/octokit/octokit.net/issues/963
#r "./packages/build/Cake.Git/Cake.Git.dll"
#r "System.Net.Http.dll"
//////////////////////////////////////////////////////////////////////
@@ -8,7 +9,7 @@
//////////////////////////////////////////////////////////////////////
readonly var Target = Argument("target", "Default");
readonly var Configuration = Argument("configuration", "Release");
readonly var IsDryRun = Argument<bool>("dryRun", true);
readonly var IsDryRun = Argument<bool>("isDryRun", true);
readonly var GitHubOwner = Argument("gitHubOwner", "git-tfs");
readonly var GitHubRepository = Argument("gitHubRepository", "git-tfs");
readonly var IdGitHubReleaseToDelete = Argument<int>("idGitHubReleaseToDelete", -1);
@@ -23,7 +24,7 @@ const string PathToSln = ApplicationPath + ".sln";
const string BuildDirectory = ApplicationPath + "/bin";
const string buildAssetPath = @".\tmp\";
const string DownloadUrlTemplate ="https://github.com/git-tfs/git-tfs/releases/download/v{0}/";
const string ReleaseNotesPath = @"doc\release-notes\NEXT.md";
string ReleaseNotesPath = @"doc\release-notes\NEXT.md";
const string ChocolateyBuildDir = buildAssetPath + "choc";
readonly var OutputDirectory = BuildDirectory + "/" + Configuration;
@@ -45,19 +46,39 @@ Task("Help").Description("This help...")
{
Information("Release process:");
Information("----------------");
Information("1. Tag the commit with a version following the format 'v1.4'");
Information("2. run `Cake.exe build.cake -target=Release`");
Information("1. Setup the personal data in `PersonalTokens.config` file");
Information("2. run `.\build.ps1 -Target \"TriggerRelease\"`");
Information("");
Information("Available tasks:");
StartProcess("cake.exe", "build.cake -showdescription");
});
Task("PrepareRelease").Description("TODO")
Task("TagVersion").Description("Handle release note and tag the new version")
.Does(() =>
{
//Create Release Note
//Create Tag
var version = GitVersion();
var tag = version.Major + "." + (version.Minor + 1);
var nextVersion = tag + ".0";
Information("Next version will be:" + nextVersion);
if(!IsDryRun)
{
Information("Creating release tag...");
if(FileExists(ReleaseNotesPath))
{
var newReleaseNotePath = @"doc\release-notes\v" + nextVersion + ".md";
MoveFile(ReleaseNotesPath, newReleaseNotePath);
GitAdd(".", newReleaseNotePath);
GitRemove(".", false, ReleaseNotesPath);
GitCommit(".", @"Git-tfs release bot", "no-reply@git-tfs.com", "Prepare release v" + tag);
ReleaseNotesPath = newReleaseNotePath;
GitPush(".", GetGithubUserAccount(), GetGithubAuthToken(), "master");
}
GitTag(".", "v" + tag);
GitPushRef(".", GetGithubUserAccount(), GetGithubAuthToken(), "origin", "refs/tags/v" + tag);
}
});
Task("Clean").Description("Clean the working directory")
@@ -84,7 +105,7 @@ Task("InstallTfsModels").Description("Install the missing TFS object models to b
}
});
Task("Restore-NuGet-Packages").Description("Restore nuget dependencies")
Task("Restore-NuGet-Packages").Description("Restore nuget dependencies (with paket)")
.IsDependentOn("Clean")
.Does(() =>
{
@@ -270,6 +291,14 @@ string GetChocolateyToken()
return ReadToken("Chocolatey");
}
string GetGithubUserAccount()
{
var gitHubOAuthToken = Argument("gitHubUserAccount", "");
if(!string.IsNullOrEmpty(gitHubOAuthToken))
return gitHubOAuthToken;
return ReadToken("GitHubUserAccount");
}
string GetGithubAuthToken()
{
var gitHubOAuthToken = Argument("gitHubToken", "");
@@ -298,13 +327,15 @@ Task("TriggerRelease").Description("Trigger a release from the AppVeyor build se
.Does(() =>
{
var httpClient = new System.Net.Http.HttpClient();
//AppVeyor build data to trigger the git-tfs build + parameters passed to the release build
var content = @"{
accountName: 'git-tfs',
accountName: 'pmiossec',
projectSlug: 'git-tfs-v2qcm',
branch: 'master',
environmentVariables: {
target: 'AppVeyorRelease',
chocolateyToken: '"+ GetChocolateyToken() + @"',
gitHubUserAccount: '"+ GetGithubUserAccount() + @"',
gitHubToken: '" + GetGithubAuthToken() + @"'
}
}";
@@ -430,24 +461,31 @@ Task("Chocolatey").Description("Generate the chocolatey package")
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default").Description("")
.IsDependentOn("Package");
Task("Default").Description("Run the unit tests")
.IsDependentOn("Run-Unit-Tests");
Task("AppVeyorBuild").Description("Do the continuous integration build with AppVeyor")
.IsDependentOn("Run-Smoke-Tests")
.IsDependentOn("Package");
Task("AppVeyorRelease").Description("Do the release build with AppVeyor")
.IsDependentOn("TagVersion")
.IsDependentOn("InstallTfsModels")
.IsDependentOn("Run-Smoke-Tests")
.IsDependentOn("Package")
//.IsDependentOn("CreateGithubRelease")
//.IsDependentOn("Chocolatey")
.IsDependentOn("CreateGithubRelease")
.IsDependentOn("Chocolatey")
;
Task("Release").Description("Build the release and put it on github.com")
.IsDependentOn("Chocolatey");
//TODO:
//- 'Clean all' Task!
//CodeFormatter!!!!!
//Sonar
//Coverage
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
+1
View File
@@ -20,6 +20,7 @@ group Build
source https://nuget.org/api/v2
nuget Cake
nuget Cake.Git
nuget GitVersion.CommandLine
//nuget Octokit //We can't use the official version at the moment :( https://github.com/octokit/octokit.net/issues/963
nuget xunit.runner.console
+1
View File
@@ -62,5 +62,6 @@ FRAMEWORK: NET45
NUGET
remote: https://www.nuget.org/api/v2
Cake (0.19.4)
Cake.Git (0.14)
GitVersion.CommandLine (3.6.5)
xunit.runner.console (2.2)