-
Notifications
You must be signed in to change notification settings - Fork 21
/
ChangeVersion.ps1
29 lines (22 loc) · 1.25 KB
/
ChangeVersion.ps1
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
26
27
28
29
[CmdletBinding()]
Param(
[String][Parameter(Mandatory=$True)]$Version
)
Set-StrictMode -version Latest
$ErrorActionPreference = "Stop"
Write-Host "Updating version number to $Version" -ForegroundColor Green
Function AssignVersionToFile {
[CmdletBinding()]
Param (
[String][Parameter(Mandatory=$True)]$Path,
[String][Parameter(Mandatory=$True)]$RegEx,
[String][Parameter(Mandatory=$True)]$Replacement
)
(Get-Content $Path) -Replace $RegEx, $Replacement | Out-File $Path -Encoding UTF8
}
AssignVersionToFile -Path "$PSScriptRoot\GoToWindow.nuspec" -RegEx "<version>[^<]+</version>" -Replacement "<version>$($Version)</version>"
AssignVersionToFile -Path "$PSScriptRoot\GoToWindow.Shared\Properties\AssemblyInfo.Shared.cs" -RegEx "`"(\d+\.\d+\.\d+)`"" -Replacement "`"$($Version)`""
AssignVersionToFile -Path "$PSScriptRoot\chocolatey\gotowindow.nuspec" -RegEx "<version>[^<]+</version>"-Replacement "<version>$($Version)</version>"
AssignVersionToFile -Path "$PSScriptRoot\chocolatey\tools\chocolateyinstall.ps1" -RegEx "(\d+\.\d+\.\d+)" -Replacement "$($Version)"
Write-Host "IMPORTANT: Remember to update chocolatey\tools\chocolateyinstall.ps1 with ``checksum -t sha256 Releases\GoToWindow.Setup.VER.exe``"
Write-Host "Version updated!" -ForegroundColor Green