DecSm.Atom.Module.GithubWorkflows 1.0.0-rc.491

This is a prerelease version of DecSm.Atom.Module.GithubWorkflows.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DecSm.Atom.Module.GithubWorkflows --version 1.0.0-rc.491
                    
NuGet\Install-Package DecSm.Atom.Module.GithubWorkflows -Version 1.0.0-rc.491
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DecSm.Atom.Module.GithubWorkflows" Version="1.0.0-rc.491" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DecSm.Atom.Module.GithubWorkflows" Version="1.0.0-rc.491" />
                    
Directory.Packages.props
<PackageReference Include="DecSm.Atom.Module.GithubWorkflows" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DecSm.Atom.Module.GithubWorkflows --version 1.0.0-rc.491
                    
#r "nuget: DecSm.Atom.Module.GithubWorkflows, 1.0.0-rc.491"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DecSm.Atom.Module.GithubWorkflows@1.0.0-rc.491
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DecSm.Atom.Module.GithubWorkflows&version=1.0.0-rc.491&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DecSm.Atom.Module.GithubWorkflows&version=1.0.0-rc.491&prerelease
                    
Install as a Cake Tool

Atom

Build

Atom is an opinionated task and build automation framework, written in C#.

Inspired by the likes of NUKE, Atom aims to provide a flexible, extensible framework for defining and executing build tasks. It leverages .NET and provides a comprehensive set of features for automating your development workflow with automatic CI/CD pipeline generation e.g. for GitHub Actions and Azure DevOps.

✨ Features

  • 🎯 Type-Safe Build Definitions: Define build targets using strongly-typed C# interfaces and classes
  • 🔄 Automatic CI/CD Generation: Generate GitHub Actions and Azure DevOps pipelines from your build definitions
  • 📦 Artifact Management: Built-in support for artifact storage and retrieval with CI/CD host or a custom provider
  • 🔐 Secret Management: Secure secret handling with .NET secrets or custom providers
  • 🧩 Modular Architecture: Extensible module system for different platforms and tools
  • ⚙️ Parameter Management: Flexible parameter system with validation and optional interactive prompting
  • 📊 Reporting: Comprehensive build reporting with CI/CD platform integration
  • 🔨 .NET Tooling: Built-in support for .NET operations (build, test, pack, publish)
  • 📝 Source Generation: Automatic code generation for build definitions

🚀 Quick Start

1. Create a New Build Project

Create a new console application and add the Atom package:

dotnet new console -n MyBuild
cd MyBuild
dotnet add package DecSm.Atom

2. Define Your Build

Create a Build.cs file:

using DecSm.Atom.Build.Definition;
using DecSm.Atom.Hosting;

namespace MyBuild;

[BuildDefinition]
[GenerateEntryPoint]
internal partial class Build : BuildDefinition
{
    private Target HelloWorld =>
        t => t
            .DescribedAs("Prints a hello world message")
            .Executes(() => Logger.LogInformation("Hello, World!"));
}

Targets can also be async:

private Target HelloWorldAsync =>
    t => t
        .DescribedAs("Prints a hello world message asynchronously")
        .Executes(async () =>
        {
            await Task.Delay(1000); // Simulate async work
            Logger.LogInformation("Hello, World!");
        });

private Target HelloWorldAsyncWithCancel =>
    t => t
        .DescribedAs("Prints a hello world message asynchronously")
        .Executes(async cancellationToken =>
        {
            await Task.Delay(1000, cancellationToken); // Simulate async work with cancellation
            Logger.LogInformation("Hello, World!");
        });

3. Run Your Build

dotnet run -- HelloWorld

📚 Documentation

Basic Concepts

Build Definitions

Build definitions are classes that inherit from BuildDefinition and define targets (build steps) as properties:

[BuildDefinition]
internal partial class Build : BuildDefinition
{
    private Target Compile => t => t
        .DescribedAs("Compiles the project")
        .Executes(() =>
        {
            // Your build logic here
        });
}
Parameters

Define and use parameters in your builds:

[ParamDefinition("my-name", "Name to greet")]
private string? MyName => GetParam(() => MyName);

private Target Hello => t => t
    .RequiresParam(nameof(MyName))
    .Executes(() =>
    {
        Logger.LogInformation("Hello, {Name}!", MyName);
    });
Target Dependencies

Define dependencies between targets:

private Target Test => t => t
    .DependsOn(Compile)
    .Executes(() =>
    {
        // Run tests after compilation
    });

Target Interfaces

You can also define targets using interfaces for better organization:

using DecSm.Atom.Build.Definition;
[BuildDefinition]
internal partial class Build : BuildDefinition, ICompile, ITest;

public interface ICompile
{
    Target Compile => t => t
        .DescribedAs("Compiles the project")
        .Executes(() =>
        {
            // Your build logic here
        });
}

public interface ITest
{
    Target Test => t => t
        .DependsOn(Compile)
        .Executes(() =>
        {
            // Run tests after compilation
        });
}

Access Build Services

You can access various build services like logging, parameters, and secrets:

public interface ICompile : IBuildAccessor
{
    Target Compile => t => t
        .DescribedAs("Compiles the project")
        .Executes(() =>
        {
            Logger.LogInformation("Compiling project...");
            FileSystem.File.Create("output.txt");
            Services.Get<IService>().DoSomething();
        });
}

CI/CD Integration

Atom can automatically generate CI/CD pipelines for your builds:

GitHub Actions

Install the required modules for your CI/CD platform (GitHub Actions, Azure DevOps, etc.):

dotnet add package DecSm.Atom.Module.GithubWorkflows
[BuildDefinition]
public partial class Build : BuildDefinition, IGithubWorkflows
{
    public override IReadOnlyList<WorkflowDefinition> Workflows =>
    [
        new("ci")
        {
            Triggers = [new GitPullRequestTrigger { IncludedBranches = ["main"] }],
            StepDefinitions = [Targets.Test],
            WorkflowTypes = [new GithubWorkflowType()]
        }
    ];
}
Azure DevOps

Install the required modules for your CI/CD platform (GitHub Actions, Azure DevOps, etc.):

dotnet add package DecSm.Atom.Module.DevopsWorkflows
[BuildDefinition]
public partial class Build : BuildDefinition, IDevopsWorkflows
{
    public override IReadOnlyList<WorkflowDefinition> Workflows =>
    [
        new("ci")
        {
            Triggers = [new GitPullRequestTrigger { IncludedBranches = ["main"] }],
            StepDefinitions = [Targets.Test],
            WorkflowTypes = [new DevopsWorkflowType()]
        }
    ];
}

🧩 Modules

Atom provides several modules for different functionalities:

Core Modules

  • DecSm.Atom: Core framework
  • DecSm.Atom.Module.Dotnet: .NET tooling support
  • DecSm.Atom.Module.GitVersion: GitVersion integration

CI/CD Modules

  • DecSm.Atom.Module.GithubWorkflows: GitHub Actions support
  • DecSm.Atom.Module.DevopsWorkflows: Azure DevOps support

Cloud Modules

  • DecSm.Atom.Module.AzureKeyVault: Azure Key Vault integration
  • DecSm.Atom.Module.AzureStorage: Azure Blob Storage for artifacts

Using Modules

Add modules to your build definition:

[BuildDefinition]
public partial class Build : BuildDefinition, 
    IGithubWorkflows,
    IDotnetPackHelper,
    IAzureKeyVault
{
    // Your build targets here
}

📦 Artifact Management

Atom supports artifact management with automatic upload/download in CI/CD pipelines:

private Target Package => t => t
    .ProducesArtifact("MyPackage") // Workflows automatically upload this artifact
    .Executes(() => {
        // Create your package
		
        return Task.CompletedTask;
    });

private Target Deploy => t => t
    .ConsumesArtifact(nameof(Package), "MyPackage") // Workflows automatically download this artifact
    .Executes(() =>
    {
        // Deploy the package
    });

Variable Management

Atom supports variable management for build parameters and secrets:

[ParamDefinition("my-name", "Name to greet")]
private string? MyName => GetParam(() => MyName);

private Target Info => t => t
    .ProducesVariable("MyPackage")
    .Executes(() =>
    {
        // Variable writing is done manually
        Services.GetRequiredService<IVariablesHelper>().WriteVariable(nameof(MyName), "Declan");
    });

private Target Print => t => t
    .ConsumesVariable(nameof(Info), "MyPackage") // Workflows automatically inject this variable
    .Executes(() =>
    {
        // Using the variable
        Logger.LogInformation("Hello, {Name}!", MyName);
        // output: Hello, Declan!
    });

🔧 Advanced Features

Matrix Builds

Run builds across multiple configurations:

public override IReadOnlyList<WorkflowDefinition> Workflows =>
[
    new("build")
    {
		StepDefinitions =
		[
			Targets.Test.WithMatrixDimensions(
				new MatrixDimension("os", ["ubuntu-latest", "windows-latest", "macos-latest"])),
        ],
    }
];

Custom Artifact Providers

Use custom artifact storage backends:

public override IReadOnlyList<WorkflowDefinition> Workflows =>
[
    new("build")
    {
        Options = [UseCustomArtifactProvider.Enabled],
        // ... other configuration
    }
];

Secret Management

Integrate with Azure Key Vault:

Install the required module for Azure Key Vault:

dotnet add package DecSm.Atom.Module.AzureKeyVault
[BuildDefinition]
public partial class Build : BuildDefinition, IAzureKeyVault
{
    [SecretDefinition("my-secret", "Description of the secret")]
    private string MySecret => GetSecret(() => MySecret);
}

📋 Examples

Check out the sample projects:

  • Sample_01_HelloWorld: Basic hello world example
  • Sample_02_Params: Parameter usage and configuration

🛠️ Development

Requirements

  • .NET 8.0 or 9.0
  • Visual Studio or VS Code or Rider or any other C# IDE

Building from Source

Atom can build itself!

git clone https://github.com/DecSmith42/atom.git
cd atom
dotnet run --project _atom -- PackAtom

Even faster if you've installed the Atom tool globally:

atom PackAtom

Or the old-fashioned way:

dotnet build _atom/Atom.csproj

Running Tests

dotnet run --project _atom -- TestAtom

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

Atom is released under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-beta.feature-v-next.98 46 1/23/2026
2.3.0-rc.26 0 4/1/2026
2.3.0-rc.23 305 3/9/2026
2.3.0-rc.21 56 2/27/2026
2.3.0-rc.19 62 2/25/2026
2.3.0-rc.17 57 2/24/2026
2.3.0-rc.15 57 2/20/2026
2.3.0-rc.13 58 2/19/2026
2.3.0-rc.11 60 2/17/2026
2.3.0-rc.9 61 2/17/2026
2.3.0-rc.5 714 2/12/2026
2.3.0-rc.2 84 2/11/2026
2.3.0-rc.1 68 2/11/2026
2.2.0 1,400 2/11/2026
2.2.0-rc.4 51 2/11/2026
2.1.0 293 2/11/2026
2.1.0-rc.65 49 2/11/2026
2.1.0-rc.61 54 2/11/2026
2.1.0-rc.49 56 2/6/2026
1.0.0-rc.491 142 6/4/2025
Loading failed