From a5a6c4b0028d0e5016f8ef426bfcde4330eeaaea Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Mon, 1 Apr 2024 14:15:50 +0200 Subject: [PATCH] Attempt at fixing publish to NuGet --- build/Build.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index d17dcd6..ab5141c 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -15,7 +15,7 @@ [ShutdownDotNetAfterServerBuild] partial class Build : NukeBuild, IPublish { - public static int Main() => Execute(x => ((ICompile) x).Compile); + public static int Main() => Execute(x => ((ICompile)x).Compile); [GitRepository] readonly GitRepository GitRepository; @@ -33,10 +33,10 @@ partial class Build : NukeBuild, IPublish string PublicNuGetSource => "https://api.nuget.org/v3/index.json"; string FeedzNuGetSource => "https://f.feedz.io/acornima/acornima/nuget/index.json"; - [Parameter] [Secret] readonly string PublicNuGetApiKey; - [Parameter] [Secret] readonly string FeedzNuGetApiKey; + [Parameter][Secret] readonly string PublicNuGetApiKey; + [Parameter][Secret] readonly string FeedzNuGetApiKey; - bool IsPublicRelease => GitRepository.IsOnMainOrMasterBranch() && IsTaggedBuild; + bool IsPublicRelease => IsTaggedBuild; string IPublish.NuGetSource => IsPublicRelease ? PublicNuGetSource : FeedzNuGetSource; string IPublish.NuGetApiKey => IsPublicRelease ? PublicNuGetApiKey : FeedzNuGetApiKey; @@ -59,23 +59,22 @@ protected override void OnBuildInitialized() } Log.Information("BUILD SETUP"); - Log.Information("Configuration:\t{Configuration}", ((IHazConfiguration) this).Configuration); + Log.Information("Configuration:\t{Configuration}", ((IHazConfiguration)this).Configuration); Log.Information("Version suffix:\t{VersionSuffix}", VersionSuffix); Log.Information("Version:\t\t{Version}", Version); Log.Information("Tagged build:\t{IsTaggedBuild}", IsTaggedBuild); } - Target Clean => _ => _ + public Target Clean => _ => _ .Before(x => x.Restore) .Executes(() => { SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); TestDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); - ((IHazArtifacts) this).ArtifactsDirectory.CreateOrCleanDirectory(); + ((IHazArtifacts)this).ArtifactsDirectory.CreateOrCleanDirectory(); }); - public IEnumerable TestProjects => ((IHazSolution) this).Solution.AllProjects.Where(x => x.Name.Contains("Tests")); - + public IEnumerable TestProjects => ((IHazSolution)this).Solution.AllProjects.Where(x => x.Name.Contains("Tests")); public Configure CompileSettings => _ => _ .SetVersion(Version)