Ayaka.Nuke
Provides various opinionated build components for simpler build automation using NUKE.
Key Features
Ayaka.Nuke is all about reusable build components and tasks to make your life easier.
The build components and tasks follow a simple naming convention:
IHave...to extend the build with additional context. For exampleIHaveSources,IHaveTests,IHaveArtifacts, etc. to provide conventional paths for sources, tests, artifacts and other directories to the buildIHaveGitRepositoryto provide information about the current Git repository to the buildIHaveGitVersionto provide information about the current Git version configuration to the buildIHaveNuGetConfigurationto have NuGet API client parameters on the buildIHaveGitHubTokento have GitHub API client parameters on the build- and many more
ICan...to extend the build with additional targets. For exampleICanCleanto clean the build directoriesICanDotNet...to restore, build, test and pack .NET projectsICanVitePress...to lint and build a VitePress siteICanShipPublicApisto ship public APIs fromPublicAPI.Unshipped.txttoPublicAPI.Shipped.txt- and many more
...Tasksto provide build tasks that wrap other tools or APIs. For exampleGitHubTasksto create pull requests, generate release notes or create new releases using the GitHub APIDotNetValidateTasksto validate .NET NuGet packages usingdotnet-validatetool- and many more
TIP
In a NUKE build project, a build component represents additional build context or targets that can be added to a build, whereas a build task is a method that can be executed as part of target.
How to Use
Using any of the build components is as simple as decorating your build class. For example:
class Build
: NukeBuild
IHaveSources,
ICanDotNetRestore,
ICanDotNetBuild
{
public static int Main() => Execute<Build>(x => x.Default);
Target Default => target => target
.DependsOn<IHaveDotNetRestoreTarget>()
.DependsOn<IHaveDotNetBuildTarget>();
}Using any of the build tasks is the same as calling a static method in .NET
await GitHubTasks.CreateRelease(new GitHubReleaseSettings
{
// ...
});or with a static using
using static Ayaka.Nuke.GitHub.GitHubTasks;
await CreateRelease(new GitHubReleaseSettings
{
// ...
});TIP
If you still struggle to understand how this all works, have a look at Ayaka's own NUKE build project. It uses Ayaka.Nuke (eat your own dog food) and is a good starting point to see how to use the build components and tasks.