diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 4d51768..9793f95 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -1,4 +1,4 @@
-name: .Net
+name: Build & Test PrettyBlazor
on:
push:
branches:
@@ -8,14 +8,15 @@ on:
- master
jobs:
build:
- runs-on: windows-2019
+ name: Build
+ runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v2
- - name: Setup .Net
+ - name: Setup Dot Net Version
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 9.0.203
+ dotnet-version: 9.0.101
include-prerelease: true
- name: Restore
run: dotnet restore
diff --git a/PrettyBlazor.Infrastructure.Build/PrettyBlazor.Infrastructure.Build.csproj b/PrettyBlazor.Infrastructure.Build/PrettyBlazor.Infrastructure.Build.csproj
index b031926..287fd24 100644
--- a/PrettyBlazor.Infrastructure.Build/PrettyBlazor.Infrastructure.Build.csproj
+++ b/PrettyBlazor.Infrastructure.Build/PrettyBlazor.Infrastructure.Build.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/PrettyBlazor.Infrastructure.Build/Program.cs b/PrettyBlazor.Infrastructure.Build/Program.cs
index 73bb5f3..edaa49a 100644
--- a/PrettyBlazor.Infrastructure.Build/Program.cs
+++ b/PrettyBlazor.Infrastructure.Build/Program.cs
@@ -4,11 +4,9 @@
// See License.txt in the project root for license information.
// ---------------------------------------------------------------
-using System.Collections.Generic;
-using ADotNet.Clients;
+using System.IO;
+using ADotNet.Clients.Builders;
using ADotNet.Models.Pipelines.GithubPipelines.DotNets;
-using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks;
-using ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks.SetupDotNetTaskV1s;
namespace PrettyBlazor.Infrastructure.Build
{
@@ -16,69 +14,32 @@ internal class Program
{
static void Main(string[] args)
{
- var adotNetClient = new ADotNetClient();
+ string buildScriptPath = "../../../../.github/workflows/dotnet.yml";
+ string directoryPath = Path.GetDirectoryName(buildScriptPath);
- var githubPipeline = new GithubPipeline
+ if (Directory.Exists(directoryPath) is false)
{
- Name = ".Net",
-
- OnEvents = new Events
- {
- Push = new PushEvent
- {
- Branches = new string[] { "master" }
- },
-
- PullRequest = new PullRequestEvent
- {
- Branches = new string[] { "master" }
- }
- },
-
- Jobs = new Jobs
- {
- Build = new BuildJob
- {
- RunsOn = BuildMachines.Windows2019,
-
- Steps = new List
- {
- new CheckoutTaskV2
- {
- Name = "Check Out"
- },
-
- new SetupDotNetTaskV1
- {
- Name = "Setup .Net",
-
- TargetDotNetVersion = new TargetDotNetVersion
- {
- DotNetVersion = "9.0.203",
- IncludePrerelease = true
- }
- },
-
- new RestoreTask
- {
- Name = "Restore"
- },
-
- new DotNetBuildTask
- {
- Name = "Build"
- },
-
- new TestTask
- {
- Name = "Test"
- }
- }
- }
- }
- };
-
- adotNetClient.SerializeAndWriteToFile(githubPipeline, "../../../../.github/workflows/dotnet.yml");
+ Directory.CreateDirectory(directoryPath);
+ }
+
+ GitHubPipelineBuilder.CreateNewPipeline()
+ .SetName("Build & Test PrettyBlazor")
+ .OnPush("master")
+ .OnPullRequest("master")
+ .AddJob("build", job => job
+ .WithName("Build")
+ .RunsOn(BuildMachines.UbuntuLatest)
+ .AddCheckoutStep("Check Out")
+
+ .AddSetupDotNetStep(
+ version: "9.0.101",
+ includePrerelease: true)
+
+ .AddRestoreStep()
+ .AddBuildStep()
+ .AddTestStep())
+
+ .SaveToFile(buildScriptPath);
}
}
}