azure-sdk-for-cpp/eng/common/testproxy/override-proxy-version.ps1
Azure SDK Bot f0a26fd4ad
enable true version override so that other tools also have a shot at picking up the replaced version (#4440)
Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
2023-03-13 15:25:27 -07:00

26 lines
815 B
PowerShell

<#
.SYNOPSIS
Replaces target test-proxy version present in target_version.txt.
.PARAMETER TargetVersion
The replacement version. Used in its entirety, so don't exclude parts of the version definition.
#>
[cmdletbinding(SupportsShouldProcess=$True)]
param(
[Parameter(mandatory=$true)] [string] $TargetVersion
)
$versionFile = Join-Path $PSScriptRoot "target_version.txt"
$existingVersionText = Get-Content -Raw -Path $versionFile
$existingVersion = $existingVersionText.Trim()
if ($PSCmdLet.ShouldProcess($versionFile)){
Write-Host "Replacing version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile."
Set-Content -Path $versionFile -Value "$TargetVersion`n"
}
else {
Write-Host "Would replace version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile."
}