Skip to content

Commit 48d96aa

Browse files
authored
Merge pull request #1436 from nunit/issue-1428b
Fix Build script problems with api keys
2 parents c4d49d0 + ad6848a commit 48d96aa

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

cake/build-settings.cake

+13-7
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,22 @@ public static class BuildSettings
220220
? CommandLineOptions.TestLevel.Value
221221
: CalcPackageTestLevel();
222222

223-
// Publishing
223+
// Publishing - MyGet
224224
public static string MyGetPushUrl => MYGET_PUSH_URL;
225+
public static string MyGetApiKey => Context.EnvironmentVariable(MYGET_API_KEY);
226+
227+
// Publishing - NuGet
225228
public static string NuGetPushUrl => NUGET_PUSH_URL;
229+
public static string NuGetApiKey => Context.EnvironmentVariable(NUGET_API_KEY);
230+
231+
// Publishing - Chocolatey
226232
public static string ChocolateyPushUrl => CHOCO_PUSH_URL;
233+
public static string ChocolateyApiKey => Context.EnvironmentVariable(CHOCO_API_KEY);
227234

228-
public static string MyGetApiKey { get; private set; }
229-
public static string NuGetApiKey { get; private set; }
230-
public static string ChocolateyApiKey { get; private set;}
231-
public static string GitHubOwner { get; private set; }
232-
public static string GitHubRepository { get; private set; }
233-
public static string GitHubAccessToken { get; private set; }
235+
// Publishing - GitHub
236+
public static string GitHubOwner { get; set; }
237+
public static string GitHubRepository { get; set; }
238+
public static string GitHubAccessToken => Context.EnvironmentVariable(GITHUB_ACCESS_TOKEN);
234239

235240
public static bool IsPreRelease => BuildVersion.IsPreRelease;
236241
public static bool ShouldPublishToMyGet =>
@@ -318,6 +323,7 @@ public static class BuildSettings
318323
Console.WriteLine("MyGetApiKey: " + (!string.IsNullOrEmpty(MyGetApiKey) ? "AVAILABLE" : "NOT AVAILABLE"));
319324
Console.WriteLine("NuGetApiKey: " + (!string.IsNullOrEmpty(NuGetApiKey) ? "AVAILABLE" : "NOT AVAILABLE"));
320325
Console.WriteLine("ChocolateyApiKey: " + (!string.IsNullOrEmpty(ChocolateyApiKey) ? "AVAILABLE" : "NOT AVAILABLE"));
326+
Console.WriteLine("GitHubAccessToken: " + (!string.IsNullOrEmpty(GitHubAccessToken) ? "AVAILABLE" : "NOT AVAILABLE"));
321327

322328
Console.WriteLine("\nPACKAGES");
323329
foreach (var package in Packages)

0 commit comments

Comments
 (0)