Logicality.GitHub.Actions.Workflow 0.2.5

This package has a SemVer 2.0.0 package version: 0.2.5+build.93.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Logicality.GitHub.Actions.Workflow --version 0.2.5                
NuGet\Install-Package Logicality.GitHub.Actions.Workflow -Version 0.2.5                
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="Logicality.GitHub.Actions.Workflow" Version="0.2.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Logicality.GitHub.Actions.Workflow --version 0.2.5                
#r "nuget: Logicality.GitHub.Actions.Workflow, 0.2.5"                
#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.
// Install Logicality.GitHub.Actions.Workflow as a Cake Addin
#addin nuget:?package=Logicality.GitHub.Actions.Workflow&version=0.2.5

// Install Logicality.GitHub.Actions.Workflow as a Cake Tool
#tool nuget:?package=Logicality.GitHub.Actions.Workflow&version=0.2.5                

GitHub Actions Workflow

Nuget

Introduction

A library to help generate GitHub Actions Workflows yaml in a fluent manner. Written to support a better authoring experience, increase reusability and mitigate against the fragility of copy'n'pasting stuff around. If one is maintaining just a few simple workflows this is probably over-kill. If one is maintaining many workflows across many repositories where one wants to be able to to reuse standardised jobs and steps, then this may be useful.

Simple Example

The following code:


var workflow = new Workflow("my-workflow");

workflow.On
    .Push()
    .Branches("main")
    
var buildJob = workflow
    .Job("build")
    .RunsOn(GitHubHostedRunner.UbuntuLatest);

buildJob.Step()
    .ActionsCheckout(); // Via extensions package

buildJob.Step()
    .Name("Build")
    .Run($"./build.ps1")
    .Shell(Shells.PowerShell);

workflow.WriteYaml("../workflows/my-workflow.yml", yaml);

... will generate the following yaml:

name: my-workflow
on:
  push:
    branches:
    - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Build
      run: ./build.ps1
      shell: pwsh

See WorkflowGen in this repository for a more comprehensive example.

Using

  1. Create a new console project WorkflowGen (or what ever you want call it). I recommend putting in the ./github/ directory.

    dotnet new console --name WorkflowGen

  2. Add the necessary package reference:

    cd WorkflowGen
    dotnet add package Logicality.GitHub.Actions.Workflow --prerelease
    
  3. Add some workflow generating code:

    using Logicality.GitHub.Actions.Workflow;
    
    var workflow = new Workflow("my-workflow");
    
     workflow.On
       .Push()
       .Branches("main");
    
     // Workflow path relative to console project
     workflow.WriteYaml("../workflows/my-workflow.yaml"); 
    
    
  4. Generate the workflow:

    dotnet run

  5. Re-generate the workflow when ever you make changes by calling dotnet run

The API should be discoverable if one is familiar with GitHub Workflow Syntax. This project is not a substitute for understanding and learning the syntax.

Contributing

  • Open a discussion if any questions, feedback or requests.
  • Open an issue if there are any bugs with a full reproducible.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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 Logicality.GitHub.Actions.Workflow:

Package Downloads
Logicality.GitHub.Actions.Workflow.Extensions

A collection of extensions and common steps and jobs for GitHub Actions Workflow library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.1 139 11/12/2024
0.5.0 51 11/5/2024
0.4.0 45 11/3/2024
0.3.0 146 12/5/2022
0.2.7 1,072 8/9/2022
0.2.6 116 8/6/2022
0.2.5 124 5/14/2022
0.2.4 103 5/14/2022
0.2.3 103 5/14/2022
0.2.2 103 5/14/2022
0.2.1 99 5/14/2022
0.2.0 120 4/20/2022
0.1.0 115 4/19/2022
0.1.0-alpha.0 58 12/5/2022