Refactoring script to create master branch
This commit is contained in:
parent
fb6bbee561
commit
0ea0a44e15
|
|
@ -192,43 +192,30 @@ var buildTarget = "compile"
|
|||
#pull-all
|
||||
-Parallel.ForEach(GetAllRepos(), CloneOrUpdate);
|
||||
|
||||
#update-master
|
||||
#update-master .pull-all
|
||||
-// Merge release branch to master
|
||||
@{
|
||||
foreach (var repo in GetAllRepos())
|
||||
{
|
||||
CloneOrUpdate(repo);
|
||||
|
||||
GitCommand(repo, "checkout origin/release -B master");
|
||||
|
||||
if(File.Exists(Path.Combine(repo, "NuGet.config")))
|
||||
{
|
||||
File.Copy(Path.Combine("build-template", "NuGet.master.config"),
|
||||
Path.Combine(repo, "NuGet.config"),
|
||||
overwrite: true);
|
||||
GitCommand(repo, "commit -am \"Updating NuGet.config\"");
|
||||
}
|
||||
|
||||
GitCommand(repo, "push origin master:master -f");
|
||||
}
|
||||
}
|
||||
|
||||
#pin-version
|
||||
-// Pin versions of packages in project.json and updated project.lock.json
|
||||
-// More information https://github.com/aspnet/Universe/wiki/%23pin-version-:-Pinning-package-version-for-a-particular-release-in-project.json
|
||||
@{
|
||||
var coherenceFeed = Environment.GetEnvironmentVariable("COHERENCE_FEED");
|
||||
if (string.IsNullOrEmpty(coherenceFeed))
|
||||
|
||||
var COHERENCE_FEED = Environment.GetEnvironmentVariable("COHERENCE_FEED");
|
||||
if (string.IsNullOrEmpty(COHERENCE_FEED))
|
||||
{
|
||||
throw new Exception("COHERENCE_FEED not specified. Usually this is Packages-NoTimestamp directory of Coherence-Signed.");
|
||||
}
|
||||
|
||||
var korebuildVersion = Environment.GetEnvironmentVariable("KOREBUILD_VERSION");
|
||||
if (string.IsNullOrEmpty(korebuildVersion))
|
||||
var KOREBUILD_VERSION = Environment.GetEnvironmentVariable("KOREBUILD_VERSION");
|
||||
if (string.IsNullOrEmpty(KOREBUILD_VERSION))
|
||||
{
|
||||
throw new Exception("KOREBUILD_VERSION environment variable is not specified.");
|
||||
}
|
||||
|
||||
var NUGET_VERSION = Environment.GetEnvironmentVariable("NUGET_VERSION");
|
||||
if (string.IsNullOrEmpty(NUGET_VERSION))
|
||||
{
|
||||
throw new Exception("NUGET_VERSION not specified. This is most recent stable build of NuGet from http://dist.nuget.org/index.html. e.g. v3.2");
|
||||
}
|
||||
|
||||
var excludeReposForJson = new[]
|
||||
{
|
||||
"Coherence",
|
||||
|
|
@ -237,23 +224,35 @@ var buildTarget = "compile"
|
|||
"Entropy"
|
||||
};
|
||||
|
||||
var repos = GetAllRepos().Except(excludeReposForJson);
|
||||
Parallel.ForEach(repos, CloneOrUpdate);
|
||||
Exec("cmd", "/C dnu restore", @"tools\PinVersion");
|
||||
|
||||
foreach (var repo in repos)
|
||||
foreach (var repo in GetAllRepos())
|
||||
{
|
||||
GitCommand(repo, "checkout master");
|
||||
GitCommand(repo, "checkout origin/release -B master");
|
||||
|
||||
if (File.Exists(Path.Combine(repo, "build.cmd")))
|
||||
if (File.Exists(Path.Combine(repo, "NuGet.config")))
|
||||
{
|
||||
File.Copy(Path.Combine("build-template", "build.cmd"),
|
||||
Path.Combine(repo, "build.cmd"),
|
||||
File.Copy(Path.Combine("build-template", "NuGet.master.config"),
|
||||
Path.Combine(repo, "NuGet.config"),
|
||||
overwrite: true);
|
||||
GitCommand(repo, "add NuGet.*");
|
||||
GitCommand(repo, "commit -m \"Updating NuGet.config\"");
|
||||
}
|
||||
}
|
||||
|
||||
var reposToPin = GetAllRepos().Except(excludeReposForJson);
|
||||
|
||||
foreach (var repo in reposToPin)
|
||||
{
|
||||
var repoPath = Path.Combine(Directory.GetCurrentDirectory(), repo);
|
||||
|
||||
Exec("dnx", string.Format(@".\tools\PinVersion run ""{0}"" ""{1}"" ""{2}""", repo, coherenceFeed, korebuildVersion), string.Empty);
|
||||
Exec("dnx",
|
||||
string.Format(@"run ""{0}"" ""{1}"" ""{2}"" ""{3}""",
|
||||
Path.Combine(Directory.GetCurrentDirectory(), repo),
|
||||
COHERENCE_FEED,
|
||||
KOREBUILD_VERSION,
|
||||
NUGET_VERSION),
|
||||
@"tools\PinVersion");
|
||||
|
||||
// Build projects to produce project.lock.json
|
||||
Exec("build.cmd", "compile", repo);
|
||||
|
|
@ -267,7 +266,7 @@ var buildTarget = "compile"
|
|||
}
|
||||
|
||||
// Add the project.json and project.lock.json files
|
||||
foreach(var file in Directory.GetFiles(repo, "project*", SearchOption.AllDirectories))
|
||||
foreach(var file in Directory.GetFiles(repo, "project*.json", SearchOption.AllDirectories))
|
||||
{
|
||||
var gitFilePath = file.Substring(file.IndexOf(repo) + repo.Length + 1);
|
||||
|
||||
|
|
@ -279,29 +278,29 @@ var buildTarget = "compile"
|
|||
}
|
||||
|
||||
GitCommand(repo, "commit -am \"Updating json files to pin versions and build.cmd to pin KoreBuild and DNX\"");
|
||||
|
||||
GitCommand(repo, "push origin master:master -f");
|
||||
}
|
||||
|
||||
foreach (var repo in GetAllRepos())
|
||||
{
|
||||
GitCommand(repo, "push origin +master:master");
|
||||
}
|
||||
|
||||
CallTarget("update-prerelease-tags");
|
||||
}
|
||||
|
||||
#update-prerelease-tags
|
||||
-// Update tags on each repo to have the latest release tag
|
||||
@{
|
||||
var newPreRelease = Environment.GetEnvironmentVariable("PRERELEASETAG");
|
||||
if(string.IsNullOrEmpty(newPreRelease))
|
||||
var PRERELEASETAG = Environment.GetEnvironmentVariable("PRERELEASETAG");
|
||||
if (string.IsNullOrEmpty(PRERELEASETAG))
|
||||
{
|
||||
Log.Warn("No prerelease tag defined");
|
||||
return;
|
||||
throw new Exception("PRERELEASETAG tag not defined");
|
||||
}
|
||||
|
||||
var versionFile = "version.txt";
|
||||
|
||||
foreach (var repo in GetAllRepos())
|
||||
{
|
||||
CloneOrUpdate(repo);
|
||||
|
||||
GitCommand(repo, "checkout master");
|
||||
|
||||
GitCommand(repo, "pull --tags");
|
||||
|
||||
try
|
||||
|
|
@ -321,13 +320,13 @@ var buildTarget = "compile"
|
|||
|
||||
var majorVersion = version.Split(new string[]{"-"}, StringSplitOptions.None)[0];
|
||||
|
||||
var newVersion = majorVersion + string.Format("-{0}", newPreRelease);
|
||||
var newVersion = majorVersion + string.Format("-{0}", PRERELEASETAG);
|
||||
|
||||
Log.Info(string.Format("New version for repo is {0}", newVersion));
|
||||
|
||||
GitCommand(repo, string.Format("tag -f -a {0} -m \"Tag for new release {0}\"", newVersion));
|
||||
|
||||
GitCommand(repo, "push -f --tags ");
|
||||
GitCommand(repo, "push origin --tags +" + newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue