mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
pipeline file changes
This commit is contained in:
parent
5861cd4aaa
commit
7c378ae9a3
1 changed files with 31 additions and 31 deletions
|
|
@ -21,42 +21,42 @@ steps:
|
||||||
[int]$VersionNumbersInVersion = 4
|
[int]$VersionNumbersInVersion = 4
|
||||||
|
|
||||||
Function Replace-Version($content, $version, $attribute) {
|
Function Replace-Version($content, $version, $attribute) {
|
||||||
$exitFunction = $false
|
$exitFunction = $false
|
||||||
$content | % {
|
$content | % {
|
||||||
if ($_ -match 'exclude from semantic versioning') {
|
if ($_ -match 'exclude from semantic versioning') {
|
||||||
Write-Host " * Skipping $attribute due to exclude"
|
Write-Host " * Skipping $attribute due to exclude"
|
||||||
$exitFunction = $true
|
$exitFunction = $true
|
||||||
}
|
|
||||||
|
|
||||||
if ($_ -match 'include semantic versioning' -and $_ -notmatch "include semantic versioning - $ApplicationName") {
|
|
||||||
Write-Host " * Skipping $attribute due to include not matching"
|
|
||||||
$exitFunction = $true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exitFunction) {
|
if ($_ -match 'include semantic versioning' -and $_ -notmatch "include semantic versioning - $ApplicationName") {
|
||||||
return $content
|
Write-Host " * Skipping $attribute due to include not matching"
|
||||||
}
|
$exitFunction = $true
|
||||||
|
|
||||||
$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 ($exitFunction) {
|
||||||
return $content
|
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) {
|
Function Get-VersionString($numberOfVersions, $extractedBuildNumbers) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue