From f598891eb6df0652a37718c76946a98b50cd22eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:39:23 +0100 Subject: [PATCH 1/7] Only build tags on master --- build.cake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 4daabff5..be5bb9b2 100644 --- a/build.cake +++ b/build.cake @@ -200,7 +200,8 @@ Task("PublishNuGetPackages") .WithCriteria(() => { var branchName = gitVersion.BranchName.Trim(); - return branchName == "master" || branchName == "develop"; + var taggedBuild = Convert.ToBoolean(EnvironmentVariable("APPVEYOR_REPO_TAG")); + return taggedBuild || branchName == "develop"; }) .Does(() => { From d29caa3eaf59b65712d89967d77f971fde0bdce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:45:11 +0100 Subject: [PATCH 2/7] Use `WithCriteria` instead of `return` --- build.cake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build.cake b/build.cake index be5bb9b2..5a84a087 100644 --- a/build.cake +++ b/build.cake @@ -79,13 +79,9 @@ Task("RestorePackages") Task("UpdateAssemblyInformation") .Description("Update assembly information using GitVersion") + .WithCriteria(isAppveyor) .Does(() => { - if (!isAppveyor) - { - return; - } - GitVersion(new GitVersionSettings { UpdateAssemblyInfo = true, From e36b3ac9fe2262637884a1a5311b7d1d58906dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:45:28 +0100 Subject: [PATCH 3/7] Use `AppVeyor.GetEnvironmentBoolean` --- build.cake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 5a84a087..5e872cd0 100644 --- a/build.cake +++ b/build.cake @@ -196,8 +196,8 @@ Task("PublishNuGetPackages") .WithCriteria(() => { var branchName = gitVersion.BranchName.Trim(); - var taggedBuild = Convert.ToBoolean(EnvironmentVariable("APPVEYOR_REPO_TAG")); - return taggedBuild || branchName == "develop"; + var taggedBuild = AppVeyor.GetEnvironmentBoolean("APPVEYOR_REPO_TAG"); + return isAppVeyor && (taggedBuild || branchName == "develop"); }) .Does(() => { From e42f57f258e10c4152e37183e99c205dba4bb165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:49:53 +0100 Subject: [PATCH 4/7] Fixes --- build.cake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 5e872cd0..02354588 100644 --- a/build.cake +++ b/build.cake @@ -195,9 +195,16 @@ Task("PublishNuGetPackages") .IsDependentOn("Package") .WithCriteria(() => { + if (!isAppVeyor) + { + return false; + } + var branchName = gitVersion.BranchName.Trim(); - var taggedBuild = AppVeyor.GetEnvironmentBoolean("APPVEYOR_REPO_TAG"); - return isAppVeyor && (taggedBuild || branchName == "develop"); + var taggedBuild = AppVeyor.Environment.GetEnvironmentBoolean("APPVEYOR_REPO_TAG"); + var tag = EnvironmentVariable("APPVEYOR_REPO_TAG_NAME"); + Information("{0}@{1}", branchName, tag); + return taggedBuild || branchName == "develop"; }) .Does(() => { From 42797faa5ee96af2b9548b2f8b26938ff335a7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:52:13 +0100 Subject: [PATCH 5/7] AppVeyor with an uppercase V --- build.cake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.cake b/build.cake index 02354588..7d8051a0 100644 --- a/build.cake +++ b/build.cake @@ -9,7 +9,7 @@ var target = Argument("target", "Default"); var configuration = Argument("configuration", "Debug"); var nugetOrgApiKey = EnvironmentVariable("NuGetOrgApiKey"); -var isAppveyor = BuildSystem.IsRunningOnAppVeyor; +var isAppVeyor = BuildSystem.IsRunningOnAppVeyor; var isTravis = BuildSystem.IsRunningOnTravisCI; ////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ var packages = new [] Setup(context => { - if (isAppveyor) + if (isAppVeyor) { AppVeyor.UpdateBuildVersion(gitVersion.FullBuildMetaData); } @@ -79,7 +79,7 @@ Task("RestorePackages") Task("UpdateAssemblyInformation") .Description("Update assembly information using GitVersion") - .WithCriteria(isAppveyor) + .WithCriteria(isAppVeyor) .Does(() => { GitVersion(new GitVersionSettings @@ -151,7 +151,7 @@ Task("Test") Exclude = IsRunningOnWindows() ? null : "NuGet,NoMono", }); - if (isAppveyor) + if (isAppVeyor) { AppVeyor.UploadTestResults(resultPath, AppVeyorTestResultsType.NUnit); } From 6d9851c6c4d3020e13fedc61e1af487cc0ae2887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sun, 11 Mar 2018 23:53:58 +0100 Subject: [PATCH 6/7] Back to Convert.ToBoolean since GetEnvironmentBoolean was protected --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 7d8051a0..5306ead5 100644 --- a/build.cake +++ b/build.cake @@ -201,7 +201,7 @@ Task("PublishNuGetPackages") } var branchName = gitVersion.BranchName.Trim(); - var taggedBuild = AppVeyor.Environment.GetEnvironmentBoolean("APPVEYOR_REPO_TAG"); + var taggedBuild = Convert.ToBoolean(EnvironmentVariable("APPVEYOR_REPO_TAG")); var tag = EnvironmentVariable("APPVEYOR_REPO_TAG_NAME"); Information("{0}@{1}", branchName, tag); return taggedBuild || branchName == "develop"; From f235fe2e87d5e8ef6ee8b5b155d13f53c32f0d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Mon, 12 Mar 2018 00:00:39 +0100 Subject: [PATCH 7/7] Added default value when there are no tags --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 5306ead5..81f6650f 100644 --- a/build.cake +++ b/build.cake @@ -202,7 +202,7 @@ Task("PublishNuGetPackages") var branchName = gitVersion.BranchName.Trim(); var taggedBuild = Convert.ToBoolean(EnvironmentVariable("APPVEYOR_REPO_TAG")); - var tag = EnvironmentVariable("APPVEYOR_REPO_TAG_NAME"); + var tag = EnvironmentVariable("APPVEYOR_REPO_TAG_NAME") ?? ""; Information("{0}@{1}", branchName, tag); return taggedBuild || branchName == "develop"; })