Skip to content

Commit

Permalink
Add Nuke build script to push packages to NuGet.org
Browse files Browse the repository at this point in the history
- Implement `PublishToNugetOrg` target in `Build` class to push packages to NuGet.org.
- Add required parameters `NUGETAPIKEY` and `NUGET_SOURCE`.
- Include logging for package push operations.
- Ensure the target depends on the `Pack` tar
  • Loading branch information
MaximST92 committed Dec 2, 2024
1 parent 807267a commit e6ff439
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/Build.Feeds.NugetDotOrg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ partial class Build
{
[Secret, Parameter] string NUGETAPIKEY;
[Secret, Parameter] string NUGET_SOURCE = "https://api.nuget.org/v3/index.json";

Target PublishToNugetOrg => _ => _
.DependsOn(Pack)
.Requires(() => NUGET_SOURCE)
Expand All @@ -25,12 +25,14 @@ partial class Build
Log.Warning("No packages found to push to NuGet.org");
return;
}

artifactPackages.ForEach(x =>
{
Log.Information("Pushing {Path} to NuGet.org", x);
DotNetNuGetPush(s=> s
DotNetNuGetPush(s => s
.SetSource(NUGET_SOURCE)
.SetApiKey(NUGETAPIKEY)
.SetTargetPath(x));
});
});
}

0 comments on commit e6ff439

Please sign in to comment.