Skip to content

Commit 8a1a7fc

Browse files
author
Hovsep Mkrtchyan
committed
Updated SetMsiVersion script to align Azure and AzureRM modules.
1 parent 2aeac08 commit 8a1a7fc

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

tools/PreparePSRelease.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# e.g. .\PreparePSRelease.ps1 9.10.11 "Spring 2018" -Patch
2+
#
13
[CmdletBinding()]
24
Param(
35
[Parameter(Mandatory=$True, Position=0)]

tools/SetMsiVersion.ps1

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Param(
1010

1111
function SetMsiVersion([string]$FilePath, [string]$MsiVersion)
1212
{
13-
$wxsPath = Join-Path $FilePath "azurecmd.wxs"
13+
$wxsPath = Join-Path $FilePath "setup\azurecmd.wxs"
1414

1515
Write-Output "Updating File: $wxsPath"
1616
$content = Get-Content $wxsPath
@@ -25,24 +25,53 @@ function SetMsiVersion([string]$FilePath, [string]$MsiVersion)
2525

2626
function SetMsiReleaseString([string]$FilePath, [string]$MsiRelease)
2727
{
28-
$wxsPath = Join-Path $FilePath "azurecmd.wxs"
28+
$wxsPath = Join-Path $FilePath "setup\azurecmd.wxs"
2929

3030
Write-Output "Updating File: $wxsPath"
3131
$content = Get-Content $wxsPath
3232
$matches = ([regex]::matches($content, '\<\?define productName="Microsoft Azure PowerShell - ([a-zA-z]+\s[\d]+)" \?\>'))
3333

3434
$prevousVersion = $matches.Groups[1].Value
35-
Write-Output "Found: $prevousVersion"
3635

3736
$content = $content.Replace("<?define productName=`"Microsoft Azure PowerShell - $prevousVersion`" ?>", "<?define productName=`"Microsoft Azure PowerShell - $MsiRelease`" ?>")
3837

3938
Set-Content -Path $wxsPath -Value $content -Encoding UTF8
4039
}
4140

41+
function AlignAsmPsdReleaseVersion([string]$FilePath, [string]$MsiVersion)
42+
{
43+
$psd1Path = Join-Path $FilePath "src\ServiceManagement\Services\Commands.Utilities\Azure.psd1"
44+
45+
$content = Get-Content $psd1Path
46+
$matches = ([regex]::matches($content, "ModuleVersion = '([\d\.]+)'\s+"))
47+
48+
$packageVersion = $matches.Groups[1].Value
49+
Write-Output "Updating version of $psd1Path from $packageVersion to $MsiVersion"
50+
$content = $content.Replace("ModuleVersion = '$packageVersion'", "ModuleVersion = '$MsiVersion'")
51+
52+
Set-Content -Path $psd1Path -Value $content -Encoding UTF8
53+
}
54+
55+
function AlignArmPsdReleaseVersion([string]$FilePath, [string]$MsiVersion)
56+
{
57+
$psd1Path = Join-Path $FilePath "tools\AzureRM\AzureRM.psd1"
58+
59+
$content = Get-Content $psd1Path
60+
$matches = ([regex]::matches($content, "ModuleVersion = '([\d\.]+)'\s+"))
61+
62+
$packageVersion = $matches.Groups[1].Value
63+
Write-Output "Updating version of $psd1Path from $packageVersion to $MsiVersion"
64+
$content = $content.Replace("ModuleVersion = '$packageVersion'", "ModuleVersion = '$MsiVersion'")
65+
66+
Set-Content -Path $psd1Path -Value $content -Encoding UTF8
67+
}
68+
4269
if (!$Folder)
4370
{
44-
$Folder = "$PSScriptRoot\..\setup"
71+
$Folder = "$PSScriptRoot\.."
4572
}
4673

4774
SetMsiVersion $Folder $Version
48-
SetMsiReleaseString $Folder $Release
75+
SetMsiReleaseString $Folder $Release
76+
AlignAsmPsdReleaseVersion $Folder $Version
77+
AlignArmPsdReleaseVersion $Folder $Version

0 commit comments

Comments
 (0)