]> git.deb.at Git - rhonda/impostor.git/commitdiff
Imrpove AppVeyor versioning
authorAeonLucid <aeonlucid@outlook.com>
Sat, 24 Oct 2020 18:05:23 +0000 (20:05 +0200)
committerAeonLucid <aeonlucid@outlook.com>
Sat, 24 Oct 2020 18:05:23 +0000 (20:05 +0200)
.gitignore
appveyor.yml
build.cake
src/Impostor.Api/Impostor.Api.csproj
src/Impostor.Hazel/Impostor.Hazel.csproj
src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj
src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj
src/Impostor.Server/Impostor.Server.csproj

index 3878f3eb6c7386e0702a240179c81dfee4fc6e55..835ced0a756a0ed4df9d9a03da89f11742e4507a 100644 (file)
@@ -2,4 +2,5 @@
 /build
 /.vs
 /src/Impostor.Plugins.Debugger/Properties/launchSettings.json
+/tools
 
index 6a2f71ae33ef9d5fc3d2f00e8f87cb0c72f3c587..3c0345ad4e66273552038b704bb9ca0482977683 100644 (file)
@@ -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
index e722643c1a43afddaeda1619cdf732c84de5f18d..5b29f7c6cfdb60c552ad84cfc6c9cb4890f198b6 100644 (file)
@@ -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>.*?<\/Version>", "<Version>" + buildVersion + "</Version>");
+        ReplaceRegexInFiles("./src/**/*.props", @"<Version>.*?<\/Version>", "<Version>" + buildVersion + "</Version>");
+    });
+
 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");
             
index 4d3a0fb87f79cd5beaa92427ee28789ee420e795..7ef6b98e1235fbf2744bf9c26f9560ab7c805b85 100644 (file)
@@ -2,11 +2,11 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
         <CodeAnalysisRuleSet>ProjectRules.ruleset</CodeAnalysisRuleSet>
         <LangVersion>9</LangVersion>
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
         <Nullable>enable</Nullable>
+        <Version>1.0.0</Version>
     </PropertyGroup>
 
     <ItemGroup>
index cf1540095d980c9bf6ee69437f67d08f08079c3e..97673046bd5df7b5a3f4937078a2b3534050f815 100644 (file)
@@ -4,7 +4,7 @@
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
         <TargetFramework>net5.0</TargetFramework>
         <DefineConstants>HAZEL_BAG</DefineConstants>
-        <DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
+        <Version>1.0.0</Version>
     </PropertyGroup>
 
     <ItemGroup>
index a4b1c66d57ae6823bd0c83d1c5af3b4a92f983d3..9eb7d3b2b2957db2aa97f18c0141eb83d9c7decb 100644 (file)
@@ -6,10 +6,6 @@
         <TargetFramework>net5.0</TargetFramework>
     </PropertyGroup>
 
-    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-        <DebugType>none</DebugType>
-    </PropertyGroup>
-
     <ItemGroup>
         <ProjectReference Include="..\Impostor.Patcher.Shared\Impostor.Patcher.Shared.csproj" />
     </ItemGroup>
index 9700ab4c718db98abf466b0f701eeea1d33e1345..9da5d050be7114e8a7ddd3b4f49e924628148a02 100644 (file)
         <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
     </PropertyGroup>
 
-    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-        <DebugType>none</DebugType>
-    </PropertyGroup>
-
     <ItemGroup>
         <ProjectReference Include="..\Impostor.Patcher.Shared\Impostor.Patcher.Shared.csproj" />
         <PackageReference Include="System.Resources.Extensions" Version="5.0.0-rc.2.20475.5" />
index 799191050e2ff2b3a8ad47eb7ca98333848a50be..9924aa76abce71a45807439d1e1215cf813e35f4 100644 (file)
@@ -8,7 +8,6 @@
         <TrimMode>Link</TrimMode>
         <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
         <ApplicationIcon>icon.ico</ApplicationIcon>
-        <DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
         <CodeAnalysisRuleSet>ProjectRules.ruleset</CodeAnalysisRuleSet>
     </PropertyGroup>