pipeline file changes

This commit is contained in:
Brett Hewitson 2022-12-29 15:51:34 +10:00
parent 50e1fc1585
commit 194dc3e3f4

View file

@ -20,15 +20,6 @@ steps:
[int]$PatternExpectedVersionNumbers = 4
[int]$VersionNumbersInVersion = 4
Write-Host "##[debug]applicationName = $ApplicationName"
Write-Host "##[debug]pathToSearch = $PathToSearch"
Write-Host "##[debug]buildNumber = $BuildNumber"
Write-Host "##[debug]searchFilter = $SearchFilter"
Write-Host "##[debug]patternSplitCharacters = $PatternSplitCharacters"
Write-Host "##[debug]pattern = $Pattern"
Write-Host "##[debug]patternExpectedVersionNumbers = $PatternExpectedVersionNumbers"
Write-Host "##[debug]versionNumbersInVersion = $VersionNumbersInVersion"
Function Replace-Version() {
param(
[Parameter(Mandatory = $true)] $content,
@ -40,12 +31,12 @@ steps:
foreach ($line in $content) {
if ($line -match 'exclude from semantic versioning') {
Write-Host " * Skipping $attribute due to exclude"
Write-Host " * Skipping $attribute due to exclude"
$exitFunction = $true
}
if ($line -match 'include semantic versioning' -and $line -notmatch "include semantic versioning - $ApplicationName") {
Write-Host " * Skipping $attribute due to include not matching"
Write-Host " * Skipping $attribute due to include not matching"
$exitFunction = $true
}
}
@ -62,7 +53,7 @@ steps:
if ($_ -match $Pattern) {
$versionReplaced = $true
$_ = $_ -replace [regex]::Escape($Matches[0]),$versionAttribute
Write-Host " * Replaced $($Matches[0]) with $versionAttribute"
Write-Host " * Replaced $($Matches[0]) with $versionAttribute"
}
$_
}
@ -97,7 +88,7 @@ steps:
$files = Get-ChildItem -Path $PathToSearch -Filter $SearchFilter -Recurse
foreach ($file in $files) {
Write-Host " -> Checking $($file.FullName)"
Write-Host "-> Checking $($file.FullName)"
# remove the read-only bit on the file
Set-ItemProperty $file.FullName -name IsReadOnly -value $false