Sharpliner 0.1.1
See the version list below for details.
dotnet add package Sharpliner --version 0.1.1
NuGet\Install-Package Sharpliner -Version 0.1.1
<PackageReference Include="Sharpliner" Version="0.1.1" />
paket add Sharpliner --version 0.1.1
#r "nuget: Sharpliner, 0.1.1"
// Install Sharpliner as a Cake Addin
#addin nuget:?package=Sharpliner&version=0.1.1
// Install Sharpliner as a Cake Tool
#tool nuget:?package=Sharpliner&version=0.1.1
Sharpliner is a .NET library containing tooling that lets you define YAML pipelines in C#. You can use Sharpliner to define Azure DevOps pipelines and GitHub actions in a type-safe comfortable environment of the C# language with the help of intellisense, avoiding syntax errors and bugs.
Getting started
All you have to do is reference our NuGet package in your project, override a class and build the project! Dead simple!
For more detailed steps, check our documentation:
You can also read about some of our features and reasons to use Sharpliner for your project.
Example
PullRequestPipeline.cs
class PullRequestPipeline : AzureDevopsPipelineDefinition
{
public override string TargetFile => "azure-pipelines.yml";
public override TargetPathType TargetPathType => TargetPathType.RelativeToGitRoot;
public override AzureDevOpsPipeline Pipeline => new()
{
Pr = new PrTrigger("main"),
Variables =
{
If.Equal(variables["Build.SourceBranch"], "refs/heads/net-6.0")
.Variable("DotnetVersion", "6.0.100"),
If.NotEqual(variables["Build.SourceBranch"], "refs/heads/net-6.0")
.Variable("DotnetVersion", "5.0.202"),
},
Jobs =
{
new Job("Build", "Build and test")
{
Pool = new HostedPool("Azure Pipelines", "windows-latest"),
Steps =
{
Task("UseDotNet@2", "Install .NET SDK") with
{
Inputs = new()
{
{ "packageType", "sdk" },
{ "version", "$(DotnetVersion)" },
}
},
Task("DotNetCoreCLI@2", "Build and test") with
{
Inputs = new()
{
{ "command", "test" },
{ "projects", "src/MyProject.sln" },
}
},
}
}
},
}
}
Sharpliner features
Apart from the obvious benefits of using static type language with IDE support, not having to have to deal with indentation problems ever again or the ability to generate YAML programatically, there are several other upsides to Sharpliner.
Pipeline validation
Your pipeline definition can be validated during publishing and you can uncover issues, such as invalid properties or just syntax errors, you would only find by trying to run the pipeline in CI. This gives you a faster dev loop and greater productivity.
Sourcing scripts from files
When you need to add cmd, PowerShell or bash steps into your pipeline, mainatining these bits inside YAML can be error prone. With Sharpliner you can keep scripts in their own files (.ps1
, .sh
..) where you get the natural environment you're used to such as syntax highlighting. Sharpliner gives you APIs to load these on build time and include them inline:
Steps =
{
Bash.FromResourceFile("embedded-script.sh") with
{
DisplayName = "Run post-build clean-up",
Timeout = TimeSpan.FromMinutes(5),
}
}
Something missing?
This project is still under development and we probably don't cover 100% of the cases. If you find a missing feature / API / property, file an issue in project's repository, or even better, file a PR and we will work with you to get you going.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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. |
-
net5.0
- YamlDotNet (>= 11.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Sharpliner:
Repository | Stars |
---|---|
sharpliner/sharpliner
Use C# instead of YAML to define your Azure DevOps pipelines
|
Version | Downloads | Last updated |
---|---|---|
1.5.15 | 41 | 4/22/2024 |
1.5.14 | 96 | 4/16/2024 |
1.5.13 | 87 | 4/15/2024 |
1.5.12 | 74 | 4/15/2024 |
1.5.11 | 80 | 4/6/2024 |
1.5.10 | 86 | 4/2/2024 |
1.5.9 | 281 | 2/16/2024 |
1.5.8 | 100 | 2/13/2024 |
1.5.7 | 655 | 1/13/2024 |
1.5.6 | 377 | 11/16/2023 |
1.5.5 | 4,561 | 4/19/2023 |
1.5.4 | 211 | 4/19/2023 |
1.5.3 | 196 | 4/10/2023 |
1.5.2 | 1,335 | 3/8/2023 |
1.5.1 | 349 | 3/5/2023 |
1.5.0 | 300 | 2/12/2023 |
1.4.12 | 650 | 1/31/2023 |
1.4.11 | 281 | 1/31/2023 |
1.4.10 | 313 | 1/30/2023 |
1.4.9 | 566 | 12/29/2022 |
1.4.8 | 370 | 11/20/2022 |
1.4.7 | 2,524 | 10/28/2022 |
1.4.6 | 405 | 10/28/2022 |
1.4.5 | 466 | 10/18/2022 |
1.4.4 | 497 | 9/16/2022 |
1.4.3 | 428 | 9/7/2022 |
1.4.2 | 427 | 9/1/2022 |
1.4.1 | 441 | 8/31/2022 |
1.3.7 | 442 | 8/26/2022 |
1.3.6 | 467 | 8/14/2022 |
1.3.5 | 501 | 7/11/2022 |
1.3.4 | 485 | 5/13/2022 |
1.3.3 | 538 | 4/17/2022 |
1.3.2 | 461 | 4/3/2022 |
1.3.1 | 619 | 3/15/2022 |
1.3.0 | 480 | 3/13/2022 |
1.2.9 | 503 | 3/5/2022 |
1.2.8 | 487 | 2/26/2022 |
1.2.7 | 498 | 2/17/2022 |
1.2.6 | 3,660 | 2/14/2022 |
1.2.5 | 467 | 2/11/2022 |
1.2.4 | 325 | 12/15/2021 |
1.2.3 | 334 | 12/5/2021 |
1.2.1 | 1,633 | 11/28/2021 |
1.2.0 | 1,369 | 11/28/2021 |
1.1.2 | 5,467 | 11/23/2021 |
1.1.1 | 367 | 11/18/2021 |
1.1.0 | 366 | 11/15/2021 |
1.0.2 | 387 | 11/8/2021 |
1.0.0 | 458 | 11/6/2021 |
0.3.9 | 397 | 11/4/2021 |
0.3.8 | 390 | 11/1/2021 |
0.3.7 | 399 | 10/24/2021 |
0.3.6 | 455 | 10/20/2021 |
0.3.5 | 387 | 10/20/2021 |
0.3.4 | 385 | 10/17/2021 |
0.3.3 | 429 | 10/16/2021 |
0.3.2 | 381 | 10/14/2021 |
0.3.1 | 335 | 10/14/2021 |
0.3.0 | 403 | 10/14/2021 |
0.2.2 | 350 | 8/30/2021 |
0.2.1 | 376 | 8/22/2021 |
0.2.0 | 384 | 8/22/2021 |
0.1.1 | 511 | 7/24/2021 |
0.1.0 | 437 | 7/24/2021 |