diff --git a/Chocolatey.Cake.Recipe/Content/packages.cake b/Chocolatey.Cake.Recipe/Content/packages.cake index 8ef2408..8b87ba3 100644 --- a/Chocolatey.Cake.Recipe/Content/packages.cake +++ b/Chocolatey.Cake.Recipe/Content/packages.cake @@ -17,6 +17,7 @@ BuildParameters.Tasks.CopyNuspecFolderTask = Task("Copy-Nuspec-Folders") BuildParameters.Tasks.CreateChocolateyPackagesTask = Task("Create-Chocolatey-Packages") .IsDependentOn("Clean") .IsDependentOn("Copy-Nuspec-Folders") + .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") .WithCriteria(() => DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory), "Skipping because Chocolatey nuspec directory is missing") .Does(() => @@ -43,6 +44,7 @@ BuildParameters.Tasks.CreateChocolateyPackagesTask = Task("Create-Chocolatey-Pac BuildParameters.Tasks.CreateNuGetPackagesTask = Task("Create-NuGet-Packages") .IsDependentOn("Clean") .IsDependentOn("Copy-Nuspec-Folders") + .WithCriteria(() => BuildParameters.ShouldRunNuGet, "Skipping because execution of NuGet has been disabled") .WithCriteria(() => DirectoryExists(BuildParameters.Paths.Directories.NuGetNuspecDirectory), "NuGet nuspec directory does not exist") .Does(() => { @@ -140,6 +142,8 @@ BuildParameters.Tasks.DotNetCorePackTask = Task("DotNetCorePack") BuildParameters.Tasks.PublishPreReleasePackagesTask = Task("Publish-PreRelease-Packages") .WithCriteria(() => !BuildParameters.IsLocalBuild || BuildParameters.ForceContinuousIntegration, "Skipping because this is a local build, and force isn't being applied") + .WithCriteria(() => !BuildParameters.IsPullRequest, "Skipping because current build is from a Pull Request") + .WithCriteria(() => !BuildParameters.IsTagged, "Skipping because current commit is tagged") .IsDependentOn("Package") .Does(() => { @@ -159,6 +163,7 @@ BuildParameters.Tasks.PublishPreReleasePackagesTask = Task("Publish-PreRelease-P BuildParameters.Tasks.PublishReleasePackagesTask = Task("Publish-Release-Packages") .WithCriteria(() => !BuildParameters.IsLocalBuild || BuildParameters.ForceContinuousIntegration, "Skipping because this is a local build, and force isn't being applied") + .WithCriteria(() => !BuildParameters.IsPullRequest, "Skipping because current build is from a Pull Request") .WithCriteria(() => BuildParameters.IsTagged, "Skipping because current commit is not tagged") .IsDependentOn("Package") .Does(() => diff --git a/Chocolatey.Cake.Recipe/Content/parameters.cake b/Chocolatey.Cake.Recipe/Content/parameters.cake index 492ee77..d6da8aa 100644 --- a/Chocolatey.Cake.Recipe/Content/parameters.cake +++ b/Chocolatey.Cake.Recipe/Content/parameters.cake @@ -60,6 +60,8 @@ public static class BuildParameters public static bool ObfuscateAssembly { get; private set; } public static bool ShouldRunInspectCode { get; private set; } public static bool ShouldRunDotNetCorePack { get; private set; } + public static bool ShouldRunChocolatey { get; private set; } + public static bool ShouldRunNuGet { get; private set; } public static bool ShouldBuildNugetSourcePackage { get; private set; } public static bool ShouldStrongNameOutputAssemblies { get; private set; } @@ -231,6 +233,8 @@ public static class BuildParameters string repositoryName = null, bool shouldRunInspectCode = true, bool shouldRunDotNetCorePack = false, + bool shouldRunChocolatey = true, + bool shouldRunNuGet = true, bool shouldBuildNugetSourcePackage = false, bool shouldStrongNameOutputAssemblies = true, bool shouldObfuscateOutputAssemblies = true, @@ -315,6 +319,8 @@ public static class BuildParameters ShouldRunInspectCode = shouldRunInspectCode; ShouldRunDotNetCorePack = shouldRunDotNetCorePack; + ShouldRunChocolatey = shouldRunChocolatey; + ShouldRunNuGet = shouldRunNuGet; ShouldBuildNugetSourcePackage = shouldBuildNugetSourcePackage; ShouldStrongNameOutputAssemblies = shouldStrongNameOutputAssemblies;