From 7c378ae9a3302e32e044c804dec4ac8cfe232639 Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Thu, 29 Dec 2022 15:12:07 +1000 Subject: [PATCH] pipeline file changes --- ...mantic-versioning-to-assembyinfo-files.yml | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.azure/pipelines/apply-semantic-versioning-to-assembyinfo-files.yml b/.azure/pipelines/apply-semantic-versioning-to-assembyinfo-files.yml index dac86bd5..10600c43 100644 --- a/.azure/pipelines/apply-semantic-versioning-to-assembyinfo-files.yml +++ b/.azure/pipelines/apply-semantic-versioning-to-assembyinfo-files.yml @@ -21,42 +21,42 @@ steps: [int]$VersionNumbersInVersion = 4 Function Replace-Version($content, $version, $attribute) { - $exitFunction = $false - $content | % { - if ($_ -match 'exclude from semantic versioning') { - Write-Host " * Skipping $attribute due to exclude" - $exitFunction = $true - } - - if ($_ -match 'include semantic versioning' -and $_ -notmatch "include semantic versioning - $ApplicationName") { - Write-Host " * Skipping $attribute due to include not matching" - $exitFunction = $true - } + $exitFunction = $false + $content | % { + if ($_ -match 'exclude from semantic versioning') { + Write-Host " * Skipping $attribute due to exclude" + $exitFunction = $true } - if ($exitFunction) { - return $content - } - - $versionAttribute = "[assembly: $attribute(""$version"")]" - $Pattern = "\[assembly: $attribute\("".*""\)\]" - $versionReplaced = $false - - $content = $content | % { - if ($_ -match $Pattern) { - $versionReplaced = $true - $_ = $_ -replace [regex]::Escape($Matches[0]),$versionAttribute - Write-Host " * Replaced $($Matches[0]) with $versionAttribute" - } - $_ - } - - if (-not $versionReplaced) { - $content += [Environment]::NewLine + $versionAttribute - Write-Host " * Added $versionAttribute to end of content" + if ($_ -match 'include semantic versioning' -and $_ -notmatch "include semantic versioning - $ApplicationName") { + Write-Host " * Skipping $attribute due to include not matching" + $exitFunction = $true } + } + if ($exitFunction) { return $content + } + + $versionAttribute = "[assembly: $attribute(""$version"")]" + $Pattern = "\[assembly: $attribute\("".*""\)\]" + $versionReplaced = $false + + $content = $content | % { + if ($_ -match $Pattern) { + $versionReplaced = $true + $_ = $_ -replace [regex]::Escape($Matches[0]),$versionAttribute + Write-Host " * Replaced $($Matches[0]) with $versionAttribute" + } + $_ + } + + if (-not $versionReplaced) { + $content += [Environment]::NewLine + $versionAttribute + Write-Host " * Added $versionAttribute to end of content" + } + + return $content } Function Get-VersionString($numberOfVersions, $extractedBuildNumbers) {