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 buildIHaveGitRepository
to provide information about the current Git repository to the buildIHaveGitVersion
to provide information about the current Git version configuration to the buildIHaveNuGetConfiguration
to have NuGet API client parameters on the buildIHaveGitHubToken
to have GitHub API client parameters on the build- and many more
ICan...
to extend the build with additional targets. For exampleICanClean
to clean the build directoriesICanDotNet...
to restore, build, test and pack .NET projectsICanVitePress...
to lint and build a VitePress siteICanShipPublicApis
to ship public APIs fromPublicAPI.Unshipped.txt
toPublicAPI.Shipped.txt
- and many more
...Tasks
to provide build tasks that wrap other tools or APIs. For exampleGitHubTasks
to create pull requests, generate release notes or create new releases using the GitHub APIDotNetValidateTasks
to validate .NET NuGet packages usingdotnet-validate
tool- 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.