Skip to content

Commit 6e4c94d

Browse files
author
Hovsep Mkrtchyan
committed
Added common file version upgrade
1 parent 50e3e5a commit 6e4c94d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tools/CommonIncrementVersion.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Mandatory=$True, Position=0)]
4+
[String]$Version,
5+
[Parameter(Mandatory=$False, Position=1)]
6+
[String]$Folder
7+
)
8+
9+
function SetCommandsCommonVersion([string]$FilePath, [string]$Version)
10+
{
11+
$powershellCs = Join-Path $FilePath "Common\Commands.Common\AzurePowerShell.cs"
12+
13+
Write-Output "Updating File: $powershellCs"
14+
$content = Get-Content $powershellCs
15+
$content = $content -replace "public const string AssemblyVersion = `"([\d\.]+)`";", "public const string AssemblyVersion = `"$Version`";"
16+
$content = $content -replace "public const string AssemblyFileVersion = `"([\d\.]+)`";", "public const string AssemblyFileVersion = `"$Version`";"
17+
18+
Set-Content -Path $powershellCs -Value $content -Encoding UTF8
19+
}
20+
21+
function SetArmCommonVersion([string]$FilePath, [string]$Version)
22+
{
23+
$assemblyConfig = Join-Path $FilePath "ResourceManager\Common\Commands.ResourceManager.Common\Properties\AssemblyInfo.cs"
24+
25+
Write-Output "Updating File: $assemblyConfig"
26+
$content = Get-Content $assemblyConfig
27+
$content = $content -replace "\[assembly: AssemblyVersion\([\w\`"\.]+\)\]", "[assembly: AssemblyVersion(`"$Version`")]"
28+
$content = $content -replace "\[assembly: AssemblyFileVersion\([\w\`"\.]+\)\]", "[assembly: AssemblyFileVersion(`"$Version`")]"
29+
30+
Set-Content -Path $assemblyConfig -Value $content -Encoding UTF8
31+
}
32+
33+
if (!$Folder)
34+
{
35+
$Folder = "$PSScriptRoot\..\src"
36+
}
37+
38+
SetCommandsCommonVersion $Folder $Version
39+
SetArmCommonVersion $Folder $Version

tools/PreparePSRelease.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ Param(
2222
.\ARMIncrementVersion.ps1 "$PSScriptRoot\..\src\Common\Storage" -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
2323
.\ARMSyncVersion.ps1 "$PSScriptRoot\..\src\Common\Storage"
2424
.\ARMIncrementVersion.ps1 "$PSScriptRoot\AzureRM" -Major $Major.IsPresent -Minor $Minor.IsPresent -Patch $Patch.IsPresent
25+
.\CommonIncrementVersion.ps1 $Version $Folder
2526
.\SetMsiVersion.ps1 $Version $Release $Folder

0 commit comments

Comments
 (0)