Skip to content

Commit 94aa7e7

Browse files
Dylan Lerchzentron
authored andcommitted
Build uplift
1 parent b485bcd commit 94aa7e7

File tree

5 files changed

+49
-9
lines changed

5 files changed

+49
-9
lines changed

.nuke/build.schema.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"build": {
77
"type": "object",
88
"properties": {
9+
"AutoDetectBranch": {
10+
"type": "boolean",
11+
"description": "Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI"
12+
},
913
"Configuration": {
1014
"type": "string",
1115
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
@@ -46,6 +50,10 @@
4650
"type": "boolean",
4751
"description": "Disables displaying the NUKE logo"
4852
},
53+
"OCTOVERSION_CurrentBranch": {
54+
"type": "string",
55+
"description": "Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch"
56+
},
4957
"Partition": {
5058
"type": "string",
5159
"description": "Partition to use on CI"
@@ -75,7 +83,8 @@
7583
"Compile",
7684
"Pack",
7785
"Restore",
78-
"Test"
86+
"TestNet6",
87+
"TestNetCoreApp31"
7988
]
8089
}
8190
},
@@ -93,7 +102,8 @@
93102
"Compile",
94103
"Pack",
95104
"Restore",
96-
"Test"
105+
"TestNet6",
106+
"TestNetCoreApp31"
97107
]
98108
}
99109
},

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,10 @@
5555
</PropertyGroup>
5656
</Target>
5757

58+
<Target Name="OverrideVersion" AfterTargets="GetBuildVersion" Condition="'$(OverridePackageVersion)'!=''">
59+
<PropertyGroup>
60+
<PackageVersion>$(OverridePackageVersion)</PackageVersion>
61+
</PropertyGroup>
62+
</Target>
63+
5864
</Project>

build/Build.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
using System;
2-
using System.Linq;
31
using Nuke.Common;
42
using Nuke.Common.CI;
53
using Nuke.Common.Execution;
6-
using Nuke.Common.Git;
74
using Nuke.Common.IO;
85
using Nuke.Common.ProjectModel;
9-
using Nuke.Common.Tooling;
106
using Nuke.Common.Tools.DotNet;
7+
using Nuke.Common.Tools.OctoVersion;
118
using Nuke.Common.Utilities.Collections;
12-
using static Nuke.Common.EnvironmentInfo;
139
using static Nuke.Common.IO.FileSystemTasks;
14-
using static Nuke.Common.IO.PathConstruction;
1510
using static Nuke.Common.Tools.DotNet.DotNetTasks;
1611

1712
[CheckBuildProjectConfigurations]
@@ -33,6 +28,17 @@ class Build : NukeBuild
3328

3429
[Solution] readonly Solution Solution;
3530

31+
[Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.",
32+
Name = "OCTOVERSION_CurrentBranch")]
33+
readonly string BranchName;
34+
35+
[Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")]
36+
readonly bool AutoDetectBranch = IsLocalBuild;
37+
38+
[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
39+
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
40+
readonly OctoVersionInfo OctoVersionInfo;
41+
3642
// For outline of original build process used by original source repository, check ./azure-pipelines/dotnet.yml
3743
Target Clean => _ => _
3844
.Before(Restore)
@@ -56,6 +62,8 @@ class Build : NukeBuild
5662
DotNetBuild(s => s
5763
.SetProjectFile(Solution)
5864
.SetConfiguration(Configuration)
65+
.SetVersion(OctoVersionInfo.FullSemVer)
66+
.SetInformationalVersion(OctoVersionInfo.InformationalVersion)
5967
.EnableNoRestore());
6068
});
6169

@@ -97,6 +105,7 @@ class Build : NukeBuild
97105
.SetRunCodeAnalysis(false)
98106
.SetIncludeSymbols(false)
99107
.SetPackageId("Octopus.LibGit2Sharp")
108+
.SetProperty("OverridePackageVersion", OctoVersionInfo.FullSemVer)
100109
.SetNoBuild(true)
101110
);
102111
});

build/_build.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Nuke.Common" Version="5.2.1" />
14+
<PackageReference Include="Nuke.Common" Version="6.0.3" />
15+
<PackageDownload Include="OctoVersion.Tool" Version="[0.2.1058]" />
1516
</ItemGroup>
1617

1718
</Project>

version.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3+
"version": "0.27.0-octopus.{height}",
4+
"publicReleaseRefSpec": [
5+
"^refs/heads/master$", // we release out of master
6+
"^refs/heads/maint/v\\d+(?:\\.\\d+)?$" // and maint/vNN branches
7+
],
8+
"cloudBuild": {
9+
"setVersionVariables": false,
10+
"buildNumber": {
11+
"enabled": false
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)