Skip to content

Commit

Permalink
Merge pull request #559 from Inxton/558-dev-build-should-be-chanined-…
Browse files Browse the repository at this point in the history
…with-publish

dev build should be chanined with publish
  • Loading branch information
PTKu authored Jan 29, 2025
2 parents 479d9cf + c0dc9ec commit c1d00bf
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

3 changes: 3 additions & 0 deletions cake/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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', "do-publish-only", Required = false, Default = false, HelpText = "Skips all steps and publishes from pre-build artefacts.")]
public bool PublishOnly { get; set; }
}
42 changes: 42 additions & 0 deletions cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public sealed class CleanUpTask : FrostingTask<BuildContext>
{
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));

Expand Down Expand Up @@ -104,6 +110,12 @@ public sealed class ProvisionTask : FrostingTask<BuildContext>
{
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)
Expand All @@ -128,6 +140,12 @@ public sealed class ApaxUpdateTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
if (context.BuildParameters.PublishOnly)
{
context.Log.Information("Skipping. Publish only.");
return;
}

if (!context.BuildParameters.DoApaxUpdate)
return;

Expand All @@ -147,6 +165,12 @@ public sealed class CatalogInstallTask : FrostingTask<BuildContext>
{
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))
Expand All @@ -165,6 +189,12 @@ public sealed class BuildTask : FrostingTask<BuildContext>
{
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 =>
Expand Down Expand Up @@ -215,6 +245,12 @@ public sealed class TestsTask : FrostingTask<BuildContext>
// 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");
Expand Down Expand Up @@ -816,6 +852,12 @@ public sealed class CreateArtifactsTask : FrostingTask<BuildContext>
{
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 =>
Expand Down

0 comments on commit c1d00bf

Please sign in to comment.