From 719587fa50f5762d78e3b1d6c14ac820ff780b38 Mon Sep 17 00:00:00 2001 From: rstam Date: Mon, 5 Jun 2017 15:07:43 -0400 Subject: [PATCH] CSHARP-1852: Push packages to myget. --- build.cake | 40 ++++++++++------- build/MongoDB.Driver-Build.nuspec | 72 ------------------------------- 2 files changed, 24 insertions(+), 88 deletions(-) delete mode 100644 build/MongoDB.Driver-Build.nuspec diff --git a/build.cake b/build.cake index e3b00f28fb..569fadb03d 100644 --- a/build.cake +++ b/build.cake @@ -36,11 +36,11 @@ var srcProjectNames = new[] var gitVersion = GitVersion(); Task("Default") - .IsDependentOn("TestAndPublish"); + .IsDependentOn("TestAndPackage"); -Task("TestAndPublish") +Task("TestAndPackage") .IsDependentOn("Test") - .IsDependentOn("Publish"); + .IsDependentOn("Package"); Task("Build") .IsDependentOn("BuildNet45") @@ -300,22 +300,30 @@ Task("PackageNugetPackages") } }); -Task("Publish") - .IsDependentOn("PublishToGithub") - .IsDependentOn("PublishToMyget"); - -Task("PublishToGithub") - .IsDependentOn("PackageReleaseZipFile") +Task("PushToMyget") .Does(() => { - // publishing to github is done manually - }); + var mygetApiKey = EnvironmentVariable("MYGETAPIKEY"); + if (mygetApiKey == null) + { + throw new Exception("MYGETAPIKEY environment variable missing"); + } -Task("PublishToMyget") - .IsDependentOn("PackageNugetPackages") - .Does(() => - { - Console.WriteLine("PublishToMyget is not implemented."); + var packageFiles = new List(); + + var nuspecFiles = GetFiles("./artifacts/packages/*.nuspec"); + foreach (var nuspecFile in nuspecFiles) + { + var packageFileName = nuspecFile.GetFilenameWithoutExtension() + ".nupkg"; + var packageFile = artifactsPackagesDirectory.CombineWithFilePath(packageFileName); + packageFiles.Add(packageFile); + } + + NuGetPush(packageFiles, new NuGetPushSettings + { + ApiKey = mygetApiKey, + Source = "https://www.myget.org/F/mongodb/api/v2/package" + }); }); Task("DumpGitVersion") diff --git a/build/MongoDB.Driver-Build.nuspec b/build/MongoDB.Driver-Build.nuspec deleted file mode 100644 index 533d18c8c7..0000000000 --- a/build/MongoDB.Driver-Build.nuspec +++ /dev/null @@ -1,72 +0,0 @@ - - - - MongoDB.Driver-Build - @driverPackageVersion@ - MongoDB, Inc. - rstam, craiggwilson - http://jobs.mongodb.org/files/logos/889002/889002.png - true - Continuous integration build of the Official MongoDB .NET driver. - http://www.mongodb.org/display/DOCS/CSharp+Language+Center - http://www.apache.org/licenses/LICENSE-2.0 - mongodb mongo nosql build - en-US - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file