From baa4a375f20e289855387cc9d53349dacc0deb00 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:01:24 +0100 Subject: [PATCH 1/4] Create draft PR for #558 From 44726f73e194d88d05cf516f679c81f6aa5d94d3 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:12:59 +0100 Subject: [PATCH 2/4] 'dev' flow now builds and is followed by publish job --- .github/workflows/dev.yml | 12 +++++++++++ cake/BuildParameters.cs | 3 +++ cake/Program.cs | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 3522d345d..7d5eeb813 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -8,6 +8,12 @@ on: - 'cake/**' - '.github/**' workflow_dispatch: + inputs: + publish: + type: boolean + required: false + default: false + description: "Set to 'true' to publish packages" jobs: build: @@ -31,4 +37,10 @@ jobs: GH_TOKEN : ${{ secrets.GH_TOKEN }} GH_USER : ${{ secrets.GH_USER }} run: dotnet run --project cake/Build.csproj --do-test --do-pack --test-level 2 + - name: "Publish packages" + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' }} + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_USER: ${{ secrets.GH_USER }} + run: dotnet run --project cake/Build.csproj --do-publish-only --do-publish --do-publish-release diff --git a/cake/BuildParameters.cs b/cake/BuildParameters.cs index 3cd80ec1e..4cac53c39 100644 --- a/cake/BuildParameters.cs +++ b/cake/BuildParameters.cs @@ -51,4 +51,7 @@ public class BuildParameters [Option('a', "apps-run", Required = false, Default = false, HelpText = "Download and run apps")] public bool AppsRun{ get; set; } + + [Option('o', "publish-only", Required = false, Default = false, HelpText = "Skips all step and publishes from pre-build artefacts.")] + public bool PublishOnly { get; set; } } \ No newline at end of file diff --git a/cake/Program.cs b/cake/Program.cs index 667417cbc..65f07400c 100644 --- a/cake/Program.cs +++ b/cake/Program.cs @@ -74,6 +74,12 @@ public sealed class CleanUpTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + context.Log.Information("Build running with following parameters:"); context.Log.Information(context.BuildParameters.ToJson(Formatting.Indented)); @@ -104,6 +110,12 @@ public sealed class ProvisionTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + ProvisionTools(context); foreach (var library in context.Libraries) @@ -128,6 +140,12 @@ public sealed class ApaxUpdateTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + if (!context.BuildParameters.DoApaxUpdate) return; @@ -147,6 +165,12 @@ public sealed class CatalogInstallTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + context.Libraries.ToList().ForEach(lib => { foreach (var apaxfile in context.GetApaxFiles(lib)) @@ -165,6 +189,12 @@ public sealed class BuildTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + if (context.BuildParameters.DoPack) { context.Libraries.ToList().ForEach(lib => @@ -215,6 +245,12 @@ public sealed class TestsTask : FrostingTask // Tasks can be asynchronous public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + if (!context.BuildParameters.DoTest) { context.Log.Warning($"Skipping tests"); @@ -816,6 +852,12 @@ public sealed class CreateArtifactsTask : FrostingTask { public override void Run(BuildContext context) { + if (context.BuildParameters.PublishOnly) + { + context.Log.Information("Skipping. Publish only."); + return; + } + if (context.BuildParameters.DoPack) { //context.Libraries.ToList().ForEach(lib => From ef6ea010eb6ccde0fcc3d3faaa3d75f5d54aa763 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:14:58 +0100 Subject: [PATCH 3/4] fix --- .github/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 7d5eeb813..b623b74da 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -8,7 +8,7 @@ on: - 'cake/**' - '.github/**' workflow_dispatch: - inputs: + inputs: publish: type: boolean required: false From c0dc9ecdea3cedc60068612b7b708b950c95947b Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Wed, 29 Jan 2025 08:21:16 +0100 Subject: [PATCH 4/4] asp --- cake/BuildParameters.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/BuildParameters.cs b/cake/BuildParameters.cs index 4cac53c39..4e036d12c 100644 --- a/cake/BuildParameters.cs +++ b/cake/BuildParameters.cs @@ -52,6 +52,6 @@ public class BuildParameters [Option('a', "apps-run", Required = false, Default = false, HelpText = "Download and run apps")] public bool AppsRun{ get; set; } - [Option('o', "publish-only", Required = false, Default = false, HelpText = "Skips all step and publishes from pre-build artefacts.")] + [Option('o', "do-publish-only", Required = false, Default = false, HelpText = "Skips all steps and publishes from pre-build artefacts.")] public bool PublishOnly { get; set; } } \ No newline at end of file