Invex.StructuredText 2.0.0

dotnet add package Invex.StructuredText --version 2.0.0
                    
NuGet\Install-Package Invex.StructuredText -Version 2.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" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Invex.StructuredText" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Invex.StructuredText" />
                    
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 --version 2.0.0
                    
#r "nuget: Invex.StructuredText, 2.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@2.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&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Invex.StructuredText&version=2.0.0
                    
Install as a Cake Tool

Invex.StructuredText

Build NuGet License: MIT .NET

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.

Packages

Package What it does
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

Features

  • Type-safe workflow authoring. Define CI/CD pipelines as C# objects with full IntelliSense and compile-time validation.
  • Unified expression system. Build conditions, string interpolation and function calls once and render them to each platform's syntax.
  • GitHub Actions. Generate workflows with 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. Generate pipelines with stages, jobs, deployment strategies (runOnce, rolling, canary), resources, templates, and parameters.
  • Deterministic output. The same model always produces the same text, so generated files diff cleanly.

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. All three packages target net10.0. The platform packages also depend on the Dunet source generator, which provides their discriminated-union model types.

Quick start

using Invex.StructuredText.Expressions;
using Invex.StructuredText.GithubActions;
using Invex.StructuredText.GithubActions.GithubActionModel;

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);

File.WriteAllText(".github/workflows/ci.yml", writer.TextWriter.ToString());

Usage

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();

See Azure DevOps Pipelines.

Dependabot

var config = new DependabotConfig
{
    Updates =
    [
        new DependabotUpdate
        {
            PackageEcosystem = PackageEcosystem.Nuget.ToYamlValue(),
            Directory = "/",
            Schedule = new() { Interval = ScheduleInterval.Weekly },
        },
    ],
};

var writer = new DependabotConfigWriter();
writer.WriteConfig(config);

var yaml = writer.TextWriter.ToString();

See Dependabot Configuration.

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);

See Expressions.

Generating files as part of your build

A small console project in your repository can regenerate every workflow file; commit the output and the diff shows exactly what changed. Use a fresh writer per file, or call writer.TextWriter.Reset() between documents. See Getting Started.

Documentation

Full documentation: https://invex-games.github.io/structured-text/

Guide Contents
Introduction What this library is, when to use it, and its key concepts
Getting Started Install and generate your first file
Expressions The unified expression system
StructuredTextWriter The indentation-aware writer behind every generator
GitHub Actions Workflows Workflow generation in depth
Dependabot Configuration dependabot.yml generation
Azure DevOps Pipelines Pipelines, stages, jobs, deployment strategies
Architecture How the packages fit together and how to extend them
FAQ Common questions and troubleshooting
API Reference Generated reference for every public type

Development

The repository requires the .NET 10 SDK selected by global.json:

dotnet build Invex.StructuredText.slnx
dotnet test Invex.StructuredText.slnx

Build and preview the documentation site with the Atom build:

atom BuildDocs
atom ServeDocs

See .github/copilot-instructions.md for repository structure, code conventions, and contributor guidance.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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 (3)

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

Package Downloads
Invex.StructuredText.GithubActions

Strongly-typed C# models for generating GitHub Actions workflows and Dependabot configurations as YAML

Invex.Atom.Workflows

An opinionated task and build automation framework

Invex.StructuredText.AzureDevopsPipelines

Strongly-typed C# models for generating Azure DevOps Pipelines YAML

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 0 10/14/2026
2.0.0-rc.27 0 10/14/2026
2.0.0-rc.25 0 10/14/2026
2.0.0-rc.17 0 10/14/2026
2.0.0-rc.15 0 10/14/2026
2.0.0-rc.13 0 10/14/2026
1.6.0-rc.7 27 10/13/2026
1.6.0-rc.2 83 9/11/2026
1.5.0 843 8/31/2026
1.5.0-rc.8 85 8/28/2026
1.5.0-rc.6 93 8/21/2026
1.5.0-rc.4 96 8/14/2026
1.5.0-rc.2 92 8/7/2026
1.4.0 5,540 8/3/2026
1.4.0-rc.6 86 8/3/2026
1.4.0-rc.4 80 7/24/2026
1.4.0-rc.2 85 7/17/2026
1.3.0 3,400 7/13/2026
1.3.0-rc.4 94 7/13/2026
1.3.0-rc.2 85 7/10/2026
Loading failed