Skip to content

Commit 577a840

Browse files
author
Hao Chen
committed
Modified ChangeLog.md and added script for ASM version changes.
1 parent 5a8948e commit 577a840

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
## 2016.01.12 version 1.1.0
12
* Azure SQL Database: Threat Detection policies:
23
* Using new Threat Detection Types
34
* Azure Redis Cache: new cmdlets for enabling and disabling diagnostics
File renamed without changes.
File renamed without changes.

tools/ASMIncrementVersion.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Mandatory=$False, Position=0)]
4+
[String]$Folder,
5+
[Parameter(ParameterSetName="Major", Mandatory=$True)]
6+
[Switch]$Major,
7+
[Parameter(ParameterSetName="Minor", Mandatory=$True)]
8+
[Switch]$Minor,
9+
[Parameter(ParameterSetName="Patch", Mandatory=$True)]
10+
[Switch]$Patch
11+
)
12+
13+
# Function to update nuspec file
14+
function IncrementVersion([string]$FilePath)
15+
{
16+
Write-Output "Updating File: $FilePath"
17+
$content = Get-Content $FilePath
18+
$matches = ([regex]::matches($content, "ModuleVersion = '([\d\.]+)'"))
19+
20+
$packageVersion = $matches.Groups[1].Value
21+
$version = $packageVersion.Split(".")
22+
23+
$cMajor = $Major
24+
$cMinor = $Minor
25+
$cPatch = $Patch
26+
27+
if ($cMajor)
28+
{
29+
$version[0] = 1 + $version[0]
30+
$version[1] = "0"
31+
$version[2] = "0"
32+
}
33+
34+
if ($cMinor)
35+
{
36+
$version[1] = 1 + $version[1]
37+
$version[2] = "0"
38+
}
39+
40+
if ($cPatch)
41+
{
42+
$version[2] = 1 + $version[2]
43+
}
44+
45+
$version = [String]::Join(".", $version)
46+
47+
Write-Output "Updating version of $FilePath from $packageVersion to $version"
48+
$content = $content.Replace("ModuleVersion = '$packageVersion'", "ModuleVersion = '$version'")
49+
50+
Set-Content -Path $FilePath -Value $content -Encoding UTF8
51+
return $version
52+
}
53+
54+
# Function to sync assembly version with module version
55+
function SyncVersion([string]$FilePath, [string] $packageVersion)
56+
{
57+
Write-Output "Updating AssemblyInfo.cs inside of $FilePath to $packageVersion"
58+
59+
$assemblyInfos = Get-ChildItem -Path $FilePath -Filter AssemblyInfo.cs -Recurse
60+
ForEach ($assemblyInfo in $assemblyInfos)
61+
{
62+
$content = Get-Content $assemblyInfo.FullName
63+
$content = $content -replace "\[assembly: AssemblyVersion\([\w\`"\.]+\)\]", "[assembly: AssemblyVersion(`"$packageVersion`")]"
64+
$content = $content -replace "\[assembly: AssemblyFileVersion\([\w\`"\.]+\)\]", "[assembly: AssemblyFileVersion(`"$packageVersion`")]"
65+
Write-Output "Updating assembly version in " $assemblyInfo.FullName
66+
Set-Content -Path $assemblyInfo.FullName -Value $content -Encoding UTF8
67+
}
68+
#$content = $content.Replace("ModuleVersion = '$packageVersion'", "ModuleVersion = '$version'")
69+
70+
#Set-Content -path $FilePath -value $content
71+
}
72+
73+
if (!$Folder)
74+
{
75+
$Folder = "$PSScriptRoot\..\src\ServiceManagement"
76+
}
77+
78+
79+
$psd1Path = $Folder + "\Services\Commands.Utilities\Azure.psd1"
80+
$version = IncrementVersion $psd1Path
81+
SyncVersion $Folder

0 commit comments

Comments
 (0)