From: AeonLucid Date: Sat, 24 Oct 2020 18:05:23 +0000 (+0200) Subject: Imrpove AppVeyor versioning X-Git-Tag: v1.2.2~96^2~16 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=2ff01c599ad0dc8734da3c3f0e7e850b13951586;p=rhonda%2Fimpostor.git Imrpove AppVeyor versioning --- diff --git a/.gitignore b/.gitignore index 3878f3e..835ced0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /build /.vs /src/Impostor.Plugins.Debugger/Properties/launchSettings.json +/tools diff --git a/appveyor.yml b/appveyor.yml index 6a2f71a..3c0345a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,8 @@ -version: '1.1.{build}' +version: '{build}' + +environment: + IMPOSTOR_VERSION: '1.1.0' + DOTNET_CLI_TELEMETRY_OPTOUT: 1 branches: except: @@ -11,19 +15,10 @@ assembly_info: patch: false dotnet_csproj: - patch: true - file: '**\*.csproj;**\*.props' - version: '{version}' - package_version: '{version}' - assembly_version: '{version}' - file_version: '{version}' - informational_version: '{version}' + patch: false image: Visual Studio 2019 Preview -environment: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - install: - git submodule update --init --recursive - ps: dotnet tool restore diff --git a/build.cake b/build.cake index e722643..5b29f7c 100644 --- a/build.cake +++ b/build.cake @@ -1,18 +1,26 @@ -var buildVersion = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "1.0.0"; +#addin "nuget:?package=Cake.FileHelpers&Version=3.3.0" + +var buildId = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "0"; +var buildVersion = EnvironmentVariable("IMPOSTOR_VERSION") ?? "1.0.0"; +var buildBranch = EnvironmentVariable("APPVEYOR_REPO_BRANCH") ?? "dev"; var buildDir = MakeAbsolute(Directory("./build")); -var branch = EnvironmentVariable("APPVEYOR_REPO_BRANCH") ?? "dev"; var prNumber = EnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"); var target = Argument("target", "Deploy"); var configuration = Argument("configuration", "Release"); +// On any branch that is not master, we need to tag the version as prerelease. +if (buildBranch != "master") { + buildVersion = buildVersion + "-ci." + buildId; +} + ////////////////////////////////////////////////////////////////////// // UTILS ////////////////////////////////////////////////////////////////////// public void ImpostorPublish(string name, string project, string runtime) { - var projBuildDir = buildDir.Combine(name + "-" + runtime); - var projBuildZip = buildDir.CombineWithFilePath(name + "-" + buildVersion + "-" + runtime + ".zip"); + var projBuildDir = buildDir.Combine(name + "_" + runtime); + var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip"); DotNetCorePublish(project, new DotNetCorePublishSettings { Configuration = configuration, @@ -30,8 +38,8 @@ public void ImpostorPublish(string name, string project, string runtime) { public void ImpostorPublishNF(string name, string project) { var runtime = "win-x64"; - var projBuildDir = buildDir.Combine(name + "-" + runtime); - var projBuildZip = buildDir.CombineWithFilePath(name + "-" + buildVersion + "-" + runtime + ".zip"); + var projBuildDir = buildDir.Combine(name + "_" + runtime); + var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip"); DotNetCorePublish(project, new DotNetCorePublishSettings { Configuration = configuration, @@ -62,8 +70,16 @@ Task("Restore") DotNetCoreRestore("./src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj"); }); +Task("Patch") + .WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor) + .Does(() => { + ReplaceRegexInFiles("./src/**/*.csproj", @".*?<\/Version>", "" + buildVersion + ""); + ReplaceRegexInFiles("./src/**/*.props", @".*?<\/Version>", "" + buildVersion + ""); + }); + Task("Build") .IsDependentOn("Clean") + .IsDependentOn("Patch") .IsDependentOn("Restore") .Does(() => { // Tests. @@ -72,9 +88,9 @@ Task("Build") }); // Only build artifacts if; - // - branch is master/dev + // - buildBranch is master/dev // - it is not a pull request - if ((branch == "master" || branch == "dev") && string.IsNullOrEmpty(prNumber)) { + if ((buildBranch == "master" || buildBranch == "dev") && string.IsNullOrEmpty(prNumber)) { // Client. ImpostorPublishNF("Impostor-Patcher", "./src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj"); diff --git a/src/Impostor.Api/Impostor.Api.csproj b/src/Impostor.Api/Impostor.Api.csproj index 4d3a0fb..7ef6b98 100644 --- a/src/Impostor.Api/Impostor.Api.csproj +++ b/src/Impostor.Api/Impostor.Api.csproj @@ -2,11 +2,11 @@ netstandard2.0 - None ProjectRules.ruleset 9 true enable + 1.0.0 diff --git a/src/Impostor.Hazel/Impostor.Hazel.csproj b/src/Impostor.Hazel/Impostor.Hazel.csproj index cf15400..9767304 100644 --- a/src/Impostor.Hazel/Impostor.Hazel.csproj +++ b/src/Impostor.Hazel/Impostor.Hazel.csproj @@ -4,7 +4,7 @@ true net5.0 HAZEL_BAG - None + 1.0.0 diff --git a/src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj b/src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj index a4b1c66..9eb7d3b 100644 --- a/src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj +++ b/src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj @@ -6,10 +6,6 @@ net5.0 - - none - - diff --git a/src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj b/src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj index 9700ab4..9da5d05 100644 --- a/src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj +++ b/src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj @@ -12,10 +12,6 @@ true - - none - - diff --git a/src/Impostor.Server/Impostor.Server.csproj b/src/Impostor.Server/Impostor.Server.csproj index 7991910..9924aa7 100644 --- a/src/Impostor.Server/Impostor.Server.csproj +++ b/src/Impostor.Server/Impostor.Server.csproj @@ -8,7 +8,6 @@ Link true icon.ico - None ProjectRules.ruleset