-
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 #74 from hassanhabib/users/cjdutoit/data-job-publish
INFRASTRUCTURE: Publish Job
- Loading branch information
Showing
6 changed files
with
148 additions
and
12 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -89,10 +89,11 @@ static void Main(string[] args) | |
Needs = new string[] { "build" }, | ||
|
||
If = | ||
"github.event.pull_request.merged &&\r" | ||
+ "github.event.pull_request.base.ref == 'master' &&\r" | ||
+ "startsWith(github.event.pull_request.title, 'RELEASES:') &&\r" | ||
+ "contains(github.event.pull_request.labels.*.name, 'RELEASES')\r", | ||
"needs.build.result == 'success' &&\r" | ||
+ "github.event.pull_request.merged &&\r" | ||
+ "github.event.pull_request.base.ref == 'master' &&\r" | ||
+ "startsWith(github.event.pull_request.title, 'RELEASES:') &&\r" | ||
+ "contains(github.event.pull_request.labels.*.name, 'RELEASES')", | ||
|
||
Steps = new List<GithubTask> | ||
{ | ||
|
@@ -122,8 +123,7 @@ static void Main(string[] args) | |
{ | ||
Name = "Configure Git", | ||
Run = | ||
"git config user.name \"GitHub Action\"" | ||
+ "\r" | ||
"git config user.name \"GitHub Action\"\r" | ||
+ "git config user.email \"[email protected]\"" | ||
}, | ||
|
||
|
@@ -168,6 +168,54 @@ static void Main(string[] args) | |
} | ||
} | ||
} | ||
}, | ||
Publish = new PublishJob | ||
{ | ||
RunsOn = BuildMachines.UbuntuLatest, | ||
Needs = new string[] { "add_tag" }, | ||
|
||
If = | ||
"needs.add_tag.result == 'success'", | ||
|
||
Steps = new List<GithubTask> { | ||
new CheckoutTaskV3 | ||
{ | ||
Name = "Check out" | ||
}, | ||
|
||
new SetupDotNetTaskV3 | ||
{ | ||
Name = "Setup .Net", | ||
|
||
TargetDotNetVersion = new TargetDotNetVersionV3 | ||
{ | ||
DotNetVersion = "7.0.201" | ||
} | ||
}, | ||
|
||
new RestoreTask | ||
{ | ||
Name = "Restore" | ||
}, | ||
|
||
new DotNetBuildTask | ||
{ | ||
Name = "Build", | ||
Run = "dotnet build --no-restore --configuration Release" | ||
}, | ||
|
||
new PackTask | ||
{ | ||
Name = "Pack NuGet Package", | ||
|
||
}, | ||
|
||
new NugetPushTask | ||
{ | ||
Name = "Push NuGet Package", | ||
} | ||
|
||
}, | ||
} | ||
} | ||
}; | ||
|
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
31 changes: 31 additions & 0 deletions
31
ADotNet/Models/Pipelines/GithubPipelines/DotNets/PublishJob.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,31 @@ | ||
// --------------------------------------------------------------------------- | ||
// 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 ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks; | ||
using YamlDotNet.Serialization; | ||
|
||
namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets | ||
{ | ||
public class PublishJob | ||
{ | ||
[YamlMember(Order = 0, Alias = "runs-on")] | ||
public string RunsOn { get; set; } | ||
|
||
[YamlMember(Order = 1, Alias = "needs", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public string[] Needs { get; set; } | ||
|
||
[YamlMember(Order = 2, Alias = "if", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public string If { get; set; } | ||
|
||
[YamlMember(Order = 3, Alias = "env", DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] | ||
public Dictionary<string, string> EnvironmentVariables { get; set; } | ||
|
||
[YamlMember(Order = 4)] | ||
public List<GithubTask> Steps { get; set; } | ||
} | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/NugetPushTask.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,16 @@ | ||
// --------------------------------------------------------------------------- | ||
// 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 YamlDotNet.Serialization; | ||
|
||
namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks | ||
{ | ||
public class NugetPushTask : GithubTask | ||
{ | ||
[YamlMember(Order = 1)] | ||
public string Run = "dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}"; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/PackNugetTask.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,16 @@ | ||
// --------------------------------------------------------------------------- | ||
// 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 YamlDotNet.Serialization; | ||
|
||
namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks | ||
{ | ||
public class PackTask : GithubTask | ||
{ | ||
[YamlMember(Order = 1)] | ||
public string Run = "dotnet pack --configuration Release"; | ||
} | ||
} |