File: override-proxy-version.ps1

package info (click to toggle)
python-azure 20251104%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 770,224 kB
  • sloc: python: 6,357,217; ansic: 804; javascript: 287; makefile: 198; sh: 193; xml: 109
file content (25 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<#
.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."
}