File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ $ReadmePath = Join-Path $PSScriptRoot ' README.md'
2+ If (-not (Test-Path $ReadmePath )) {
3+ Write-Error ' Unable to find README.md'
4+ Exit 1
5+ }
6+
7+ $ReadmeContents = Get-Content $ReadmePath - Raw
8+ [regex ]$Regex = ' dotnet tool install --global https --version (.+)-\*'
9+ $Match = $Regex.Match ($ReadmeContents )
10+ If (-not $Match.Success ) {
11+ Write-Error ' Unable to find version information in README.md'
12+ Exit 1
13+ }
14+
15+ $HttpsCsprojPath = Join-Path $PSScriptRoot ' src/https/https.csproj'
16+ If (-not (Test-Path $HttpsCsprojPath )) {
17+ Write-Error ' Unable to find https.csproj'
18+ Exit 1
19+ }
20+
21+ [xml ]$HttpsCsproj = Get-Content $HttpsCsprojPath
22+
23+ $Expected = $HttpsCsproj.Project.PropertyGroup.VersionPrefix |
24+ Where-Object { $null -ne $_ } |
25+ ForEach-Object { $_.ToString ().Trim() }
26+ $Actual = $Match.Groups [1 ].ToString().Trim()
27+ If ($Expected -ne $Actual ) {
28+ Write-Error " Expected to have ${Expected} version in README.md, but found ${Actual} "
29+ Exit 1
30+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ variables:
1010 buildConfiguration : ' Release'
1111
1212steps :
13+ - task : PowerShell@2
14+ inputs :
15+ filePath : ' TestReadmeVersion.ps1'
16+ failOnStderr : true
17+
1318- task : DotNetCoreCLI@2
1419 displayName : Pack https
1520 inputs :
You can’t perform that action at this time.
0 commit comments