Skip to content

Commit

Permalink
Attempt at fixing publish to NuGet
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Apr 1, 2024
1 parent d2492bc commit a5a6c4b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[ShutdownDotNetAfterServerBuild]
partial class Build : NukeBuild, IPublish
{
public static int Main() => Execute<Build>(x => ((ICompile) x).Compile);
public static int Main() => Execute<Build>(x => ((ICompile)x).Compile);

[GitRepository] readonly GitRepository GitRepository;

Expand All @@ -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;

Expand All @@ -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<IRestore>(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<Project> TestProjects => ((IHazSolution) this).Solution.AllProjects.Where(x => x.Name.Contains("Tests"));

public IEnumerable<Project> TestProjects => ((IHazSolution)this).Solution.AllProjects.Where(x => x.Name.Contains("Tests"));

public Configure<DotNetBuildSettings> CompileSettings => _ => _
.SetVersion(Version)
Expand Down

0 comments on commit a5a6c4b

Please sign in to comment.