create release pipeline v1
This commit is contained in:
14
iac/Deploy/Deploy.csproj
Normal file
14
iac/Deploy/Deploy.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ParallelPipelines" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
iac/Deploy/DeploymentConstants.cs
Normal file
6
iac/Deploy/DeploymentConstants.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Deploy;
|
||||
|
||||
public static class DeploymentConstants
|
||||
{
|
||||
public const string SolutionFileName = "SharpIDE.sln";
|
||||
}
|
||||
28
iac/Deploy/Program.cs
Normal file
28
iac/Deploy/Program.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Deploy.Steps;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using ParallelPipelines.Host;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder
|
||||
.Configuration.AddJsonFile("appsettings.Development.json", true)
|
||||
.AddUserSecrets<Program>()
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
builder.Services.AddParallelPipelines(
|
||||
builder.Configuration,
|
||||
config =>
|
||||
{
|
||||
config.Local.OutputSummaryToFile = true;
|
||||
config.Cicd.OutputSummaryToGithubStepSummary = true;
|
||||
config.Cicd.WriteCliCommandOutputsToSummary = true;
|
||||
}
|
||||
);
|
||||
builder.Services
|
||||
.AddStep<RestoreAndBuildStep>()
|
||||
;
|
||||
|
||||
using var host = builder.Build();
|
||||
|
||||
await host.RunAsync();
|
||||
29
iac/Deploy/Steps/RestoreAndBuildStep.cs
Normal file
29
iac/Deploy/Steps/RestoreAndBuildStep.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using CliWrap.Buffered;
|
||||
using ParallelPipelines.Domain.Entities;
|
||||
using ParallelPipelines.Host.Helpers;
|
||||
using ParallelPipelines.Host.InternalHelpers;
|
||||
|
||||
namespace Deploy.Steps;
|
||||
|
||||
public class RestoreAndBuildStep : IStep
|
||||
{
|
||||
public async Task<BufferedCommandResult?[]?> RunStep(CancellationToken cancellationToken)
|
||||
{
|
||||
var slnFileName = DeploymentConstants.SolutionFileName;
|
||||
var slnFile = await PipelineFileHelper.GitRootDirectory.GetFile(slnFileName);
|
||||
|
||||
var restoreResult = await PipelineCliHelper.RunCliCommandAsync(
|
||||
"dotnet",
|
||||
$"restore {slnFile.FullName}",
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
var buildResult = await PipelineCliHelper.RunCliCommandAsync(
|
||||
"dotnet",
|
||||
$"build {slnFile.FullName} --no-restore -c Release",
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
return [restoreResult, buildResult];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user