2016-10-12 19:25:06 +00:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
|
|
using Microsoft.Build.Framework;
|
|
|
|
|
using Microsoft.Build.Utilities;
|
2017-03-03 17:37:25 +00:00
|
|
|
|
using Microsoft.DotNet.VersionTools.Automation;
|
2017-03-06 17:22:28 +00:00
|
|
|
|
using System.IO;
|
2016-10-12 19:25:06 +00:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
|
{
|
|
|
|
|
public class UpdateVersionsRepo : Task
|
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
public string BranchName { get; set; }
|
|
|
|
|
|
2017-03-03 17:37:25 +00:00
|
|
|
|
[Required]
|
|
|
|
|
public string PackagesDirectory { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public string GitHubPassword { get; set; }
|
|
|
|
|
|
2016-10-12 19:25:06 +00:00
|
|
|
|
public override bool Execute()
|
|
|
|
|
{
|
2017-03-03 17:37:25 +00:00
|
|
|
|
string versionsRepoPath = $"build-info/dotnet/cli/{BranchName}";
|
2016-10-12 19:25:06 +00:00
|
|
|
|
|
2017-03-03 17:37:25 +00:00
|
|
|
|
GitHubAuth auth = new GitHubAuth(GitHubPassword);
|
|
|
|
|
GitHubVersionsRepoUpdater repoUpdater = new GitHubVersionsRepoUpdater(auth);
|
|
|
|
|
repoUpdater.UpdateBuildInfoAsync(
|
2017-03-06 17:22:28 +00:00
|
|
|
|
Directory.GetFiles(PackagesDirectory, "*.nupkg"),
|
2017-03-03 17:37:25 +00:00
|
|
|
|
versionsRepoPath).Wait();
|
2016-10-12 19:25:06 +00:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|