Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .Net
name: Build & Test PrettyBlazor
on:
push:
branches:
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ADotNet" Version="2.0.1" />
<PackageReference Include="ADotNet" Version="4.1.0" />
</ItemGroup>

</Project>
91 changes: 26 additions & 65 deletions PrettyBlazor.Infrastructure.Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,42 @@
// 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
{
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<GithubTask>
{
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);
}
}
}