Skip to content

Commit dec2264

Browse files
authored
Merge pull request #10042 from dotnet/JanKrivanek-patch-4
[vs17.7] Backport #10024
2 parents 77d58ec + b10bb1c commit dec2264

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.vsts-dotnet-ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,43 @@ trigger:
44
- vs*
55

66
jobs:
7+
- job: CheckVersionBumpOnReleaseBranches
8+
displayName: "Check Version Bump On Release Branches"
9+
steps:
10+
- powershell: |
11+
$versionsFile = "eng/Versions.props"
12+
$changedFiles = git diff --name-only HEAD HEAD~1
13+
$changedVersionsFile = $changedFiles | Where-Object { $_ -eq $versionsFile }
14+
$isInitialCommit = $false
15+
$isVersionBumped = $false
16+
if ($changedVersionsFile -ne $null) {
17+
$difference = git diff HEAD~1 $versionsFile
18+
$changedContent = $difference -join " "
19+
# 'DotNetFinalVersionKind' is expected to be added only during the initial setup of the release branch
20+
$initialCommitPattern = '-\s*<VersionPrefix>\d+\.\d+\.\d+<\/VersionPrefix> \+\s*<VersionPrefix>\d+\.\d+\.\d+<\/VersionPrefix>.*<DotNetFinalVersionKind>release<\/DotNetFinalVersionKind>'
21+
$isInitialCommit = $changedContent -match $initialCommitPattern
22+
$pattern = '-\s*<VersionPrefix>\d+\.\d+\.(?<previous>\d+)<\/VersionPrefix>.* \+\s*<VersionPrefix>\d+\.\d+\.(?<current>\d+)<\/VersionPrefix>'
23+
if (!($isInitialCommit) -and ($changedContent -match $pattern)) {
24+
try {
25+
$previousPatch = [Convert]::ToInt32($Matches.previous)
26+
$currentPatch = [Convert]::ToInt32($Matches.current)
27+
if ($currentPatch -gt $previousPatch) {
28+
$isVersionBumped = $true
29+
}
30+
} catch {
31+
Write-Host "An error occurred during conversion: $_"
32+
}
33+
}
34+
}
35+
36+
if (!($isInitialCommit -or $isVersionBumped)) {
37+
throw "Hello! I noticed that you're targeting one of our servicing branches. You need to increase the revision version number (the last part) of 'VersionPrefix' in eng/Versions.props."
38+
}
39+
condition: startsWith(variables['System.PullRequest.TargetBranch'], 'vs')
40+
displayName: "Check if patch version is bumped up"
41+
742
- job: BootstrapMSBuildOnFullFrameworkWindows
43+
dependsOn: CheckVersionBumpOnReleaseBranches
844
displayName: "Windows Full"
945
pool:
1046
vmImage: 'windows-2022'

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
33
<Project>
44
<PropertyGroup>
5-
<VersionPrefix>17.7.6</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
5+
<VersionPrefix>17.7.7</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind>
66
<PackageValidationBaselineVersion>17.6.3</PackageValidationBaselineVersion>
77
<AssemblyVersion>15.1.0.0</AssemblyVersion>
88
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>

0 commit comments

Comments
 (0)