From a3a792e7d300c275e5905200444827909236fb8d Mon Sep 17 00:00:00 2001 From: Gary Woodfine Date: Tue, 16 Jan 2024 17:34:51 +0000 Subject: [PATCH] Add NuGet and GitHub tokens as arguments in build.cake The build.cake script is now updated to accept secret environment variables like NUGET_API_KEY and GITHUB_TOKEN as arguments. This change supports the secure handling of sensitive API keys, and offers easier configuration. --- build.cake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index f68da1f..92288ef 100644 --- a/build.cake +++ b/build.cake @@ -2,6 +2,9 @@ var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); +var nuget_api_key = Argument("NUGET_API_KEY", ""); +var github_token = Argument("GITHUB_TOKEN", "") + string version = String.Empty; ////////////////////////////////////////////////////////////////////// // TASKS @@ -96,7 +99,7 @@ Task("PublishNuget") { Information("Publishing {0}...", file.GetFilename().FullPath); DotNetNuGetPush(file, new DotNetNuGetPushSettings { - ApiKey = context.EnvironmentVariable("NUGET_API_KEY"), + ApiKey = nuget_api_key, Source = "https://api.nuget.org/v3/index.json" }); } @@ -112,7 +115,7 @@ Task("PublishNuget") { Information("Publishing {0}...", file.GetFilename().FullPath); DotNetNuGetPush(file, new DotNetNuGetPushSettings { - ApiKey = EnvironmentVariable("GITHUB_TOKEN"), + ApiKey = github_token, Source = "https://nuget.pkg.github.com/threenine/index.json" }); }