Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR FOUNDATIONS: Created V2 of PublishJob which will allow you to set the dotnet target version #119

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions ADotNet/Models/Pipelines/GithubPipelines/DotNets/PublishJobV2.cs
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; }
}
}

Loading