From 087dba28cb4dc8d721eaae523c9bec4ab8a6b8e6 Mon Sep 17 00:00:00 2001 From: "L. Ellenbeck" <ellenbeck@itc.rwth-aachen.de> Date: Wed, 22 Jan 2020 16:36:46 +0100 Subject: [PATCH] Fix: nuget push --- build.cake | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/build.cake b/build.cake index 32d4193..e56efea 100644 --- a/build.cake +++ b/build.cake @@ -296,16 +296,21 @@ Task("NugetPush") .Does(() =>{ var nupkgs = GetFiles($"{nupkgDir}/*.nupkg"); Information("Need to push {0} packages", nupkgs.Count); - foreach(var nupkg in nupkgs) { - Information("Pushing {0}", nupkg); - NuGetPush(nupkg, new NuGetPushSettings { - Source = nugetSource, - ApiKey = nugetApiKey - }); + if(!String.IsNullOrWhiteSpace(nugetApiKey)) { + foreach(var nupkg in nupkgs) { + Information("Pushing {0}", nupkg);) + NuGetPush(nupkg, new NuGetPushSettings { + Source = nugetSource, + ApiKey = nugetApiKey + }); + } + } else { + Information("NugetApiKey is not set. Can't push."); + throw new Exception("NugetApiKey is not set. Can't push."); } }); -Task("MoveToArtifacts") +Task("CopyToArtifacts") .Does(() =>{ foreach(var project in projects) { if(!project.GetDirectory().ToString().EndsWith(".Tests") @@ -320,11 +325,12 @@ Task("MoveToArtifacts") Task("Prerelease") .IsDependentOn("Build") -.IsDependentOn("MoveToArtifacts"); +.IsDependentOn("CopyToArtifacts"); Task("Release") -.IsDependentOn("NugetPush") -.IsDependentOn("MoveToArtifacts"); +.IsDependentOn("NugetPack") +.IsDependentOn("CopyToArtifacts") +.IsDependentOn("NugetPush"); Task("Default") .IsDependentOn("Test"); -- GitLab