Fix UpdateVersionsRepo to always write the files correctly.

We were only building nupkgs on windows, which meant if a non-windows machine was the last leg to finish, we were writing a blank file to the versions repo.

Fix #4399
This commit is contained in:
Eric Erhardt 2017-03-03 11:37:25 -06:00
parent 70c65160f6
commit 21471aa956
10 changed files with 30 additions and 187 deletions

View file

@ -3,6 +3,7 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.VersionTools.Automation;
namespace Microsoft.DotNet.Cli.Build
{
@ -11,15 +12,21 @@ namespace Microsoft.DotNet.Cli.Build
[Required]
public string BranchName { get; set; }
[Required]
public string PackagesDirectory { get; set; }
[Required]
public string GitHubPassword { get; set; }
public override bool Execute()
{
string githubAuthToken = EnvVars.EnsureVariable("GITHUB_PASSWORD");
string nupkgFilePath = Dirs.Packages;
string branchName = BranchName;
string versionsRepoPath = $"build-info/dotnet/cli/{branchName}/Latest";
string versionsRepoPath = $"build-info/dotnet/cli/{BranchName}";
VersionRepoUpdater repoUpdater = new VersionRepoUpdater(githubAuthToken);
repoUpdater.UpdatePublishedVersions(nupkgFilePath, versionsRepoPath).Wait();
GitHubAuth auth = new GitHubAuth(GitHubPassword);
GitHubVersionsRepoUpdater repoUpdater = new GitHubVersionsRepoUpdater(auth);
repoUpdater.UpdateBuildInfoAsync(
new [] { PackagesDirectory },
versionsRepoPath).Wait();
return true;
}