Skip to content

Commit

Permalink
(GH-520) Add random ApiKey
Browse files Browse the repository at this point in the history
To set the X-NuGet-ApiKey header when pushing to sources like Azure
Artifacts.
  • Loading branch information
gep13 committed Jul 4, 2020
1 parent 68f8d6f commit cb7db3f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cake.Recipe/Content/packages.cake
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ public void PushNuGetPackages(ICakeContext context, bool isRelease, List<Package
Password = nugetSource.Credentials.Password
};

// This is required so that the X-NuGet-ApiKey is set, which is required when
// pushing to some sources, for example Azure Artifacts.
nugetPushSettings.ApiKey = "RandomToken";

context.Information("Adding NuGet source with user/pass...");
context.NuGetAddSource(isRelease ? string.Format("ReleaseSource_{0}", nugetSource.Name) : string.Format("PreReleaseSource_{0}", nugetSource.Name), nugetSource.PushUrl, nugetSourceSettings);
canPushToNuGetSource = true;
Expand Down

0 comments on commit cb7db3f

Please sign in to comment.