Invex.StructuredText.GithubActions 1.0.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Invex.StructuredText.GithubActions --version 1.0.0
                    
NuGet\Install-Package Invex.StructuredText.GithubActions -Version 1.0.0
                    
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="Invex.StructuredText.GithubActions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Invex.StructuredText.GithubActions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Invex.StructuredText.GithubActions" />
                    
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 Invex.StructuredText.GithubActions --version 1.0.0
                    
#r "nuget: Invex.StructuredText.GithubActions, 1.0.0"
                    
#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 Invex.StructuredText.GithubActions@1.0.0
                    
#: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=Invex.StructuredText.GithubActions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Invex.StructuredText.GithubActions&version=1.0.0
                    
Install as a Cake Tool

Invex.StructuredText

NuGet License: MIT

A strongly-typed C# library for generating structured YAML text files, specifically GitHub Actions workflows, Dependabot configurations, and Azure DevOps Pipelines, using a fluent, type-safe API with a powerful expression system.

Features

Type-safe workflow authoring

Define CI/CD pipelines as C# objects with full IntelliSense and compile-time validation

Unified expression system

Build complex expressions (conditions, string interpolation, functions) that compile to platform-specific syntax

GitHub Actions

Full support for workflow YAML generation including triggers, jobs, steps, matrix strategies, permissions, concurrency, containers, and more

Dependabot

Generate dependabot.yml configurations with registries, update rules, groups, and schedules

Azure DevOps Pipelines

Comprehensive pipeline generation with stages, jobs, deployment strategies (runOnce, rolling, canary), resources, templates, and parameters

Packages

Package Description
Invex.StructuredText Core library with StructuredTextWriter and the expression system
Invex.StructuredText.GithubActions GitHub Actions workflow and Dependabot config generation
Invex.StructuredText.AzureDevopsPipelines Azure DevOps Pipelines YAML generation

Installation

dotnet add package Invex.StructuredText.GithubActions
# or
dotnet add package Invex.StructuredText.AzureDevopsPipelines

Both platform packages depend on Invex.StructuredText core, so it will be installed automatically.

Documentation

Comprehensive guides live in the docs/ directory:

An auto-generated API reference is built with docfx from the XML documentation comments.

Quick Start

GitHub Actions

var workflow = new GithubAction
{
    Name = "CI",
    On =
    [
        new On.Push
        {
            Branches = ["main"],
            BranchesIgnore = null,
            Tags = null,
            TagsIgnore = null,
            Paths = null,
            PathsIgnore = null,
        },
    ],
    Jobs =
    [
        new Job
        {
            Name = new RawExpression("build"),
            RunsOn = new() { Labels = [new RawExpression("ubuntu-latest")] },
            Steps =
            [
                new Step.UsesStep
                {
                    Name = new RawExpression("Checkout"),
                    Uses = new RawExpression("actions/checkout@v4"),
                },
                new Step.RunStep
                {
                    Name = new RawExpression("Build"),
                    Run = ["dotnet build --configuration Release"],
                },
            ],
        },
    ],
};

var writer = new GithubActionWriter();
writer.Write(workflow);

var yaml = writer.TextWriter.ToString();

Azure DevOps Pipelines

var pipeline = new DevopsPipeline.DevopsPipelineWithSteps
{
    Trigger = new Trigger.BranchList { Branches = ["main"] },
    Steps =
    [
        new Step.Script { ScriptContent = new RawExpression("echo Hello, world!") },
    ],
};

var writer = new DevopsPipelineWriter();
writer.Write(pipeline);

var yaml = writer.TextWriter.ToString();

Expressions

The expression system provides a fluent API for building platform-specific expressions that are formatted differently depending on the target (GitHub Actions uses ${{ }} syntax, Azure DevOps uses its own macro/runtime expression syntax).

// Reference step outputs
var output = new StepOutputExpression
{
    StepName = "build-step",
    OutputName = "artifact-path",
};

// Use conditions
var condition = output.Contains("release").Evaluate();

// String interpolation with format expressions
var formatted = TextExpressions.Format($"Release-{output}");

// Logic operators
var combined = output.Contains("main") & new BooleanExpression(true);

Architecture

Core (Invex.StructuredText)

  • StructuredTextWriter: A low-level indentation-aware text writer that handles YAML-style output with automatic indent management via IDisposable scopes
  • Expression System: A rich set of record types (TextExpression hierarchy) representing values, functions, logic operators, and workflow-specific constructs (step outputs, job outcomes, etc.)
  • TextExpressionFormatter: Base class for platform-specific expression formatters

GitHub Actions (Invex.StructuredText.GithubActions)

  • GithubActionWriter: Serializes a GithubAction model to valid workflow YAML
  • DependabotConfigWriter: Serializes a DependabotConfig model to valid dependabot.yml
  • GithubExpressionFormatter: Formats expressions using GitHub's ${{ }} syntax
  • Model types: Strongly-typed records for all GitHub Actions concepts (triggers, jobs, steps, matrix, permissions, etc.)

Azure DevOps Pipelines (Invex.StructuredText.AzureDevopsPipelines)

  • DevopsPipelineWriter: Serializes a DevopsPipeline model to valid pipeline YAML
  • DevopsExpressionFormatter: Formats expressions using Azure DevOps syntax
  • Model types: Strongly-typed records/unions for pipelines, stages, jobs, steps, resources, triggers, variables, deployment strategies, and more

Requirements

  • .NET 8.0, .NET 9.0, or .NET 10.0

License

This project is licensed under the MIT License.

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 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Invex.StructuredText.GithubActions:

Package Downloads
Invex.Atom.Module.GithubWorkflows

An opinionated task and build automation framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0-rc.6 27 6/15/2026
1.1.0-rc.4 39 6/11/2026
1.1.0-rc.2 42 6/10/2026
1.0.0 860 6/10/2026
0.4.0-rc.10 43 6/10/2026
0.3.0 1,842 6/7/2026
0.3.0-rc.1 49 6/7/2026
0.2.0 82 6/6/2026
0.2.0-rc.3 59 6/6/2026
0.2.0-rc.1 48 6/6/2026
0.1.0 78 6/6/2026
0.1.0-rc.1 43 6/6/2026