tweak build logic

This commit is contained in:
Marko Lahma
2021-08-02 18:57:36 +03:00
parent 208158c3c6
commit 65321e2c35
3 changed files with 520 additions and 515 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.IO;
@@ -12,8 +13,10 @@ public partial class Build
[Parameter] string NuGetSource => "https://api.nuget.org/v3/index.json";
[Parameter] [Secret] string NuGetApiKey;
string TagVersion => GitRepository.Tags.SingleOrDefault(x => x.StartsWith("v"))?[1..];
Target Publish => _ => _
.OnlyWhenStatic(() => GitRepository.IsOnMainBranch() || GitRepository.Branch == "github-build")
.OnlyWhenDynamic(() => GitRepository.IsOnMainBranch() && !string.IsNullOrWhiteSpace(TagVersion))
.DependsOn(Pack)
.Requires(() => NuGetApiKey)
.Executes(() =>
@@ -30,7 +33,8 @@ public partial class Build
Configure<DotNetNuGetPushSettings> PushSettingsBase => _ => _
.SetSource(NuGetSource)
.SetApiKey(NuGetApiKey);
.SetApiKey(NuGetApiKey)
.SetSkipDuplicate(true);
Configure<DotNetNuGetPushSettings> PushSettings => _ => _;
Configure<DotNetNuGetPushSettings> PackagePushSettings => _ => _;

View File

@@ -129,7 +129,7 @@ partial class Build : NukeBuild
var packTargets = GetActiveProjects()
.Where(x => !x.Name.Contains(".Test"));
var version = GitRepository.Tags.SingleOrDefault(x => x.StartsWith("v"))?[1..];
var version = TagVersion;
var suffix = "";
if (string.IsNullOrWhiteSpace(version))
{

File diff suppressed because it is too large Load Diff