mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
pipeline file changes
This commit is contained in:
parent
f93a98a0a8
commit
581ea89e4a
2 changed files with 37 additions and 4 deletions
|
|
@ -20,7 +20,40 @@ steps:
|
|||
[int]$PatternExpectedVersionNumbers = 4
|
||||
[int]$VersionNumbersInVersion = 4
|
||||
|
||||
Function Replace-Version() {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)] $content,
|
||||
[Parameter(Mandatory = $true)] [string]$version,
|
||||
[Parameter(Mandatory = $true)] [string]$attribute
|
||||
)
|
||||
|
||||
$exitFunction = $false
|
||||
|
||||
foreach ($line in $content) {
|
||||
if ($line -match 'exclude from semantic versioning') {
|
||||
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"
|
||||
$exitFunction = $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($exitFunction) {
|
||||
return $content
|
||||
}
|
||||
|
||||
return $content
|
||||
}
|
||||
|
||||
Function Get-VersionString($numberOfVersions, $extractedBuildNumbers) {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)] [int]$numberOfVersions,
|
||||
[Parameter(Mandatory = $true)] [string]$extractedBuildNumbers
|
||||
)
|
||||
|
||||
return [string]::Join('.',($extractedBuildNumbers | select -First ($numberOfVersions)))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ steps:
|
|||
[string]$CollectionUri = $env:SYSTEM_COLLECTIONURI
|
||||
[string]$ProjectName = $env:SYSTEM_TEAMPROJECT
|
||||
[string]$DefinitionId = $env:SYSTEM_DEFINITIONID
|
||||
[string]$variableName = '${{parameters.VariableName}}'
|
||||
[string]$variableValue = '${{parameters.VariableValue}}'
|
||||
[string]$accessToken = $env:SYSTEM_ACCESSTOKEN
|
||||
[string]$VariableName = '${{parameters.VariableName}}'
|
||||
[string]$VariableValue = '${{parameters.VariableValue}}'
|
||||
[string]$AccessToken = $env:SYSTEM_ACCESSTOKEN
|
||||
|
||||
if ($CollectionUri.EndsWith('/')) {
|
||||
$CollectionUri = $CollectionUri.TrimEnd('/')
|
||||
|
|
@ -38,7 +38,7 @@ steps:
|
|||
$oldValue = $definitionResponse.variables.$variableName.value
|
||||
$definitionResponse.variables.$variableName.value = $VariableValue
|
||||
|
||||
Write-Output -InputObject "Updating $variableName from $($oldValue) to $($variableValue)..."
|
||||
Write-Output -InputObject "Updating $VariableName from $($oldValue) to $($VariableValue)..."
|
||||
|
||||
$body = ConvertTo-Json -InputObject $definitionResponse -Depth 100 -Compress
|
||||
$response = Invoke-RestMethod -Method Put -Uri $definitionUrl -Headers $headers -ContentType 'application/json' -Body $body -UseBasicParsing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue