Skip to content

Commit 2aeac08

Browse files
author
Hovsep Mkrtchyan
committed
Added MSI update script
1 parent 217efc5 commit 2aeac08

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

tools/PreparePSRelease.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[CmdletBinding()]
22
Param(
3-
[Parameter(Mandatory=$False, Position=0)]
3+
[Parameter(Mandatory=$True, Position=0)]
4+
[String]$Version,
5+
[Parameter(Mandatory=$True, Position=1)]
6+
[String]$Release,
7+
[Parameter(Mandatory=$False, Position=2)]
48
[String]$Folder,
59
[Parameter(ParameterSetName="Major")]
610
[Switch]$Major,
@@ -13,4 +17,5 @@ Param(
1317
.\ASMIncrementVersion.ps1 $Folder -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
1418
.\ARMIncrementVersion.ps1 $Folder -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
1519
.\ARMSyncVersion.ps1 $Folder
16-
.\ARMIncrementVersion.ps1 "$PSScriptRoot\AzureRM" -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
20+
.\ARMIncrementVersion.ps1 "$PSScriptRoot\AzureRM" -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
21+
.\SetMsiVersion.ps1 $Version $Release $Folder

tools/SetMsiVersion.ps1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Mandatory=$True, Position=0)]
4+
[String]$Version,
5+
[Parameter(Mandatory=$True, Position=1)]
6+
[String]$Release,
7+
[Parameter(Mandatory=$False, Position=2)]
8+
[String]$Folder
9+
)
10+
11+
function SetMsiVersion([string]$FilePath, [string]$MsiVersion)
12+
{
13+
$wxsPath = Join-Path $FilePath "azurecmd.wxs"
14+
15+
Write-Output "Updating File: $wxsPath"
16+
$content = Get-Content $wxsPath
17+
$matches = ([regex]::matches($content, '\<\?define version="([\d\.]+)" \?\>'))
18+
19+
$prevousVersion = $matches.Groups[1].Value
20+
21+
$content = $content.Replace("<?define version=`"$prevousVersion`" ?>", "<?define version=`"$MsiVersion`" ?>")
22+
23+
Set-Content -Path $wxsPath -Value $content -Encoding UTF8
24+
}
25+
26+
function SetMsiReleaseString([string]$FilePath, [string]$MsiRelease)
27+
{
28+
$wxsPath = Join-Path $FilePath "azurecmd.wxs"
29+
30+
Write-Output "Updating File: $wxsPath"
31+
$content = Get-Content $wxsPath
32+
$matches = ([regex]::matches($content, '\<\?define productName="Microsoft Azure PowerShell - ([a-zA-z]+\s[\d]+)" \?\>'))
33+
34+
$prevousVersion = $matches.Groups[1].Value
35+
Write-Output "Found: $prevousVersion"
36+
37+
$content = $content.Replace("<?define productName=`"Microsoft Azure PowerShell - $prevousVersion`" ?>", "<?define productName=`"Microsoft Azure PowerShell - $MsiRelease`" ?>")
38+
39+
Set-Content -Path $wxsPath -Value $content -Encoding UTF8
40+
}
41+
42+
if (!$Folder)
43+
{
44+
$Folder = "$PSScriptRoot\..\setup"
45+
}
46+
47+
SetMsiVersion $Folder $Version
48+
SetMsiReleaseString $Folder $Release

0 commit comments

Comments
 (0)