-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathbumpVersion.ps1
28 lines (22 loc) · 998 Bytes
/
bumpVersion.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function UpdateVersionAndReleaseNotes {
param (
[Parameter(Mandatory=$true)]
[PSCustomObject]$ReleaseNotesResult,
[Parameter(Mandatory=$true)]
[string]$XmlFilePath
)
# Load XML
$xmlContent = New-Object XML
$xmlContent.Load($XmlFilePath)
# Update VersionPrefix and PackageReleaseNotes
$versionPrefixElement = $xmlContent.SelectSingleNode("//VersionPrefix")
$versionPrefixElement.InnerText = $ReleaseNotesResult.Version
$packageReleaseNotesElement = $xmlContent.SelectSingleNode("//PackageReleaseNotes")
$packageReleaseNotesElement.InnerText = $ReleaseNotesResult.ReleaseNotes
# Save the updated XML
$xmlContent.Save($XmlFilePath)
}
# Usage example:
# $notes = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md"
# $propsPath = Join-Path -Path (Get-Item $PSScriptRoot).Parent.FullName -ChildPath "Directory.Build.props"
# UpdateVersionAndReleaseNotes -ReleaseNotesResult $notes -XmlFilePath $propsPath