Files
5229daf8dc Sync eng/common directory with azure-sdk-tools for PR 7385 (#28002)
* Update organization of the eng/common/testproxy folder
* Add merge-proxy-tags.ps1 and readme to eng/common/testproxy/scripts/tag-merge/
* Extract common assets script functionality to common-asset-functions.ps1

---------

Co-authored-by: Scott Beddall (from Dev Box) <[email protected]>
2023-12-06 15:18:56 -08:00

26 lines
820 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."
}