Skip to content

Commit

Permalink
Add NuGet and GitHub tokens as arguments in build.cake
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gary Woodfine committed Jan 16, 2024
1 parent b1ccec0 commit a3a792e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
});
}
Expand All @@ -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"
});
}
Expand Down

0 comments on commit a3a792e

Please sign in to comment.