Skip to content

Commit e317cd6

Browse files
committed
Updating script for nuget packages to properly rev the version numbers.
1 parent d681b73 commit e317cd6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Scripts/BuildNugets.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@ function Update-Icon {
3131
$xml.Save($Path)
3232
}
3333

34+
function Update-Versions {
35+
param (
36+
[string]$Path
37+
)
38+
$Path = Resolve-Path $Path
39+
[xml] $xml = Get-Content $Path
40+
41+
foreach($dependency in $xml.package.metadata.dependencies.group.dependency){
42+
if ($dependency.id -eq "MaterialDesignColors") {
43+
$dependency.version = Get-VersionString $MDIXColorsVersion
44+
} elseif ($dependency.id -eq "MaterialDesignThemes") {
45+
$dependency.version = Get-VersionString $MDIXVersion
46+
}
47+
}
48+
$xml.Save($Path)
49+
}
50+
51+
function Get-VersionString {
52+
param (
53+
[string]$Version
54+
)
55+
56+
$callback = {
57+
[int]$args[0].Value + 1
58+
}
59+
60+
$re = [regex]"^\d+"
61+
$nextVersion = $re.Replace($Version, $callback)
62+
return "[$Version,$nextVersion)"
63+
}
64+
3465
function New-Nuget {
3566
param (
3667
[string]$NuSpecPath,
@@ -44,6 +75,10 @@ function New-Nuget {
4475

4576
Push-Location "$(Join-Path $PSScriptRoot "..")"
4677

78+
Update-Versions .\MaterialDesignColors.nuspec
79+
Update-Versions .\MaterialDesignThemes.nuspec
80+
Update-Versions .\MaterialDesignThemes.MahApps.nuspec
81+
4782
New-Nuget .\MaterialDesignColors.nuspec $MDIXColorsVersion
4883
New-Nuget .\MaterialDesignThemes.nuspec $MDIXVersion
4984
New-Nuget .\MaterialDesignThemes.MahApps.nuspec $MDIXMahAppsVersion

0 commit comments

Comments
 (0)