-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from The-Standard-Organization/users/cjdutoit…
…/minorfoundation-publish-job MINOR FOUNDATIONS: Created V2 of PublishJob which will allow you to set the dotnet target version
- Loading branch information
Showing
1 changed file
with
102 additions
and
0 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
ADotNet/Models/Pipelines/GithubPipelines/DotNets/PublishJobV2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// --------------------------------------------------------------------------- | ||
// Copyright (c) Hassan Habib & Shri Humrudha Jagathisun All rights reserved. | ||
// Licensed under the MIT License. | ||
// See License.txt in the project root for license information. | ||
// --------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks; | ||
using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks.SetupDotNetTaskV3s; | ||
using YamlDotNet.Serialization; | ||
|
||
namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets | ||
{ | ||
public class PublishJobV2 : Job | ||
{ | ||
public PublishJobV2( | ||
string runsOn, | ||
string dependsOn, | ||
string dotNetVersion, | ||
string nugetApiKey) | ||
{ | ||
RunsOn = runsOn; | ||
Needs = new string[] { dependsOn }; | ||
|
||
If = $"needs.{dependsOn}.result == 'success'"; | ||
|
||
Steps = new List<GithubTask> { | ||
new CheckoutTaskV3 | ||
{ | ||
Name = "Check out" | ||
}, | ||
|
||
new SetupDotNetTaskV3 | ||
{ | ||
Name = "Setup .Net", | ||
|
||
With = new TargetDotNetVersionV3 | ||
{ | ||
DotNetVersion = dotNetVersion | ||
} | ||
}, | ||
|
||
new RestoreTask | ||
{ | ||
Name = "Restore" | ||
}, | ||
|
||
new DotNetBuildReleaseTask | ||
{ | ||
Name = "Build", | ||
}, | ||
|
||
new PackNugetTaskWithSymbols | ||
{ | ||
Name = "Pack NuGet Package", | ||
}, | ||
|
||
new NugetPushTask(nugetApiKey) | ||
{ | ||
Name = "Push NuGet Package", | ||
} | ||
}; | ||
|
||
} | ||
|
||
[YamlMember(Order = 0, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new string Name { get; set; } | ||
|
||
[YamlMember(Order = 1, Alias = "runs-on")] | ||
public new string RunsOn { get; set; } | ||
|
||
[YamlMember(Order = 2, Alias = "needs", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new string[] Needs { get; set; } | ||
|
||
[YamlMember(Order = 3, Alias = "if", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new string If { get; set; } | ||
|
||
[YamlMember(Order = 4, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new string Environment { get; set; } | ||
|
||
[YamlMember(Order = 5, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new DefaultValues Defaults { get; set; } | ||
|
||
[YamlMember(Order = 6)] | ||
public new List<GithubTask> Steps { get; set; } | ||
|
||
[DefaultValue(0)] | ||
[YamlMember(Order = 7, Alias = "timeout-minutes", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new int TimeoutInMinutes { get; set; } | ||
|
||
[YamlMember(Order = 8, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new Strategy Strategy { get; set; } | ||
|
||
[YamlMember(Order = 9, Alias = "env", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new Dictionary<string, string> EnvironmentVariables { get; set; } | ||
|
||
[YamlMember(Order = 10, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public new Dictionary<string, string> Outputs { get; set; } | ||
} | ||
} | ||
|