From 63d6dae7547333f14b9a1bc9909250a808194fc0 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Fri, 14 Nov 2025 23:19:18 +1000 Subject: [PATCH] create release pipeline v1 --- .github/workflows/create-release.yml | 16 ++++++++++++++ Directory.Packages.props | 3 ++- SharpIDE.sln | 25 +++++++++++++++++++++ iac/Deploy/Deploy.csproj | 14 ++++++++++++ iac/Deploy/DeploymentConstants.cs | 6 +++++ iac/Deploy/Program.cs | 28 ++++++++++++++++++++++++ iac/Deploy/Steps/RestoreAndBuildStep.cs | 29 +++++++++++++++++++++++++ 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create-release.yml create mode 100644 iac/Deploy/Deploy.csproj create mode 100644 iac/Deploy/DeploymentConstants.cs create mode 100644 iac/Deploy/Program.cs create mode 100644 iac/Deploy/Steps/RestoreAndBuildStep.cs diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..8a97814 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,16 @@ +name: Create GitHub Release +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + execute-parallel-pipeline: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-dotnet@v5 + - name: Dotnet Run Pipeline + run: dotnet run -c Release --project ./iac/Deploy/Deploy.csproj diff --git a/Directory.Packages.props b/Directory.Packages.props index cf7d7f3..85d9ad5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -48,6 +48,7 @@ + @@ -62,4 +63,4 @@ - \ No newline at end of file + diff --git a/SharpIDE.sln b/SharpIDE.sln index ef9e717..f683165 100644 --- a/SharpIDE.sln +++ b/SharpIDE.sln @@ -36,6 +36,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppHost", "tools\AppHost\Ap EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpIDE.Godot", "src\SharpIDE.Godot\SharpIDE.Godot.csproj", "{D306410D-3A28-4F1B-A09B-CA10041A7C53}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "iac", "iac", "{E239E6C6-8915-4F03-85B7-22AEAF281D14}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deploy", "iac\Deploy\Deploy.csproj", "{52CD8910-88A4-4978-B107-C7B6C7FC3557}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{3852B2EE-7495-4DE1-805F-C198E3A9FF0D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{2FAF7C76-F2D6-443D-B3A8-3FA5C4E267C7}" + ProjectSection(SolutionItems) = preProject + .github\workflows\create-release.yml = .github\workflows\create-release.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -130,6 +141,18 @@ Global {D306410D-3A28-4F1B-A09B-CA10041A7C53}.Release|x64.Build.0 = Debug|Any CPU {D306410D-3A28-4F1B-A09B-CA10041A7C53}.Release|x86.ActiveCfg = Debug|Any CPU {D306410D-3A28-4F1B-A09B-CA10041A7C53}.Release|x86.Build.0 = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|x64.ActiveCfg = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|x64.Build.0 = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|x86.ActiveCfg = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Debug|x86.Build.0 = Debug|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|Any CPU.Build.0 = Release|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|x64.ActiveCfg = Release|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|x64.Build.0 = Release|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|x86.ActiveCfg = Release|Any CPU + {52CD8910-88A4-4978-B107-C7B6C7FC3557}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -142,5 +165,7 @@ Global {C54A5E24-8F16-413F-87F1-BD5E57D2AC1E} = {DABBDFD2-C631-439C-9ACB-EDDF659D5257} {CF00AC9C-F796-4C23-8D69-370F494999D7} = {DABBDFD2-C631-439C-9ACB-EDDF659D5257} {D306410D-3A28-4F1B-A09B-CA10041A7C53} = {F4ED837F-888A-4D01-BCED-C360B9CE0865} + {52CD8910-88A4-4978-B107-C7B6C7FC3557} = {E239E6C6-8915-4F03-85B7-22AEAF281D14} + {2FAF7C76-F2D6-443D-B3A8-3FA5C4E267C7} = {3852B2EE-7495-4DE1-805F-C198E3A9FF0D} EndGlobalSection EndGlobal diff --git a/iac/Deploy/Deploy.csproj b/iac/Deploy/Deploy.csproj new file mode 100644 index 0000000..c98cd5b --- /dev/null +++ b/iac/Deploy/Deploy.csproj @@ -0,0 +1,14 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + diff --git a/iac/Deploy/DeploymentConstants.cs b/iac/Deploy/DeploymentConstants.cs new file mode 100644 index 0000000..747deb4 --- /dev/null +++ b/iac/Deploy/DeploymentConstants.cs @@ -0,0 +1,6 @@ +namespace Deploy; + +public static class DeploymentConstants +{ + public const string SolutionFileName = "SharpIDE.sln"; +} diff --git a/iac/Deploy/Program.cs b/iac/Deploy/Program.cs new file mode 100644 index 0000000..b0f65e9 --- /dev/null +++ b/iac/Deploy/Program.cs @@ -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() + .AddEnvironmentVariables(); + +builder.Services.AddParallelPipelines( + builder.Configuration, + config => + { + config.Local.OutputSummaryToFile = true; + config.Cicd.OutputSummaryToGithubStepSummary = true; + config.Cicd.WriteCliCommandOutputsToSummary = true; + } +); +builder.Services + .AddStep() + ; + +using var host = builder.Build(); + +await host.RunAsync(); diff --git a/iac/Deploy/Steps/RestoreAndBuildStep.cs b/iac/Deploy/Steps/RestoreAndBuildStep.cs new file mode 100644 index 0000000..060dc75 --- /dev/null +++ b/iac/Deploy/Steps/RestoreAndBuildStep.cs @@ -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 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]; + } +}