Skip to content

Commit c328243

Browse files
committed
Scripts/SetVersion.ps1 now updates <releaseNotes> of .nuspec file.
1 parent 79b73ed commit c328243

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Scripts/SetVersion.ps1

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,28 @@ function Update-NuspecFiles ([string] $version) {
6666
}
6767
}
6868

69+
#-------------------------------------------------------------------------------
70+
# Update <releaseNotes> element in UnitsNet.nuspec
71+
#-------------------------------------------------------------------------------
72+
function Update-NuspecFileReleaseNotes ([string] $releaseInfo) {
73+
$nugetReleaseNotesPattern = '<releaseNotes>.*?</releaseNotes>';
74+
$nugetReleaseNotes = '<releaseNotes>'+$releaseInfo+'</releaseNotes>';
75+
76+
Get-ChildItem ..\ -r | Where { $_.PSChildName -match "^UnitsNet\.nuspec$"} | ForEach-Object {
77+
$filename = $_.Directory.ToString() + '\' + $_.Name
78+
$filename + ' -> ' + $releaseInfo
79+
80+
# If you are using a source control that requires to check-out files before
81+
# modifying them, make sure to check-out the file here.
82+
# For example, TFS will require the following command:
83+
# tf checkout $filename
84+
85+
(Get-Content $filename -Encoding UTF8) | ForEach-Object {
86+
% {$_ -replace $nugetReleaseNotesPattern, $nugetReleaseNotes }
87+
} | Set-Content $filename -Encoding UTF8
88+
}
89+
}
90+
6991
#-------------------------------------------------------------------------------
7092
# Parse arguments.
7193
#-------------------------------------------------------------------------------
@@ -80,7 +102,9 @@ while ($version -notmatch "[0-9]+(\.([0-9]+|\*)){1,3}") {
80102
}
81103
}
82104

105+
$releaseNotes = Read-Host 'Enter release notes for .nuspec file'
106+
83107
Update-AssemblyInfoFiles $version
84108
Update-NuspecFiles $version
85-
109+
Update-NuspecFileReleaseNotes $releaseNotes
86110

0 commit comments

Comments
 (0)