Skip to content

Commit 28d37fc

Browse files
committed
create release notes folder and files when updating version
1 parent b16ef87 commit 28d37fc

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

scripts/update-version.ps1

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,30 @@ function Update-TextVersion([System.IO.FileInfo]$TextFile, [string]$OldVersion,
3636
[System.IO.File]::WriteAllText($TextFile, $NewContent, $Utf8NoBomEncoding)
3737
}
3838

39-
function Update-ReleaseNotes([System.IO.FileInfo]$XmlFile, [string]$Content, [string]$Version)
39+
function New-ReleaseNotes([string]$Content, [string]$Version)
4040
{
41-
[Xml]$XmlContent = Get-Content $XmlFile
42-
$NewChild = New-Object System.Xml.XmlDocument
43-
$NewChild.LoadXml($Content.Replace('%Version%', $Version))
44-
$Node = $XmlContent.SelectSingleNode('/document/body/section')
45-
$Node.PrependChild($XmlContent.ImportNode($NewChild.DocumentElement, $true))
46-
"$($XmlFile): $NewVersion"
47-
$XmlContent.Save($XmlFile)
41+
[System.IO.FileInfo]$XmlFile = "$PSScriptRoot/../src/changelog/$Version/.release.xml"
42+
$XmlFile.Directory.Create()
43+
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
44+
[System.IO.File]::WriteAllText($XmlFile, $Content, $Utf8NoBomEncoding)
45+
Copy-Item "$PSScriptRoot/../src/changelog/3.1.0/.release-notes.adoc.ftl" "$PSScriptRoot/../src/changelog/$Version/.release-notes.adoc.ftl"
4846
}
4947

5048
Update-XmlVersion $PSScriptRoot/../pom.xml $NewVersion '/*[local-name()="project"]/*[local-name()="version"]'
5149
Update-JsonVersion $PSScriptRoot/../package.json $NewVersion
5250
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.txt $OldVersion $NewVersion
5351
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.Result.txt $OldVersion $NewVersion
5452
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.Announce.txt $OldVersion $NewVersion
53+
Update-TextVersion $PSScriptRoot/build-preview.ps1 $OldVersion $NewVersion
54+
Update-TextVersion $PSScriptRoot/build-release.ps1 $OldVersion $NewVersion
5555
Update-XmlVersion $PSScriptRoot/../src/log4net/log4net.csproj $NewVersion '/Project/PropertyGroup/Version'
5656

57-
$ReleaseNoteSection = '
58-
<section id="a%Version%" name="%Version%">
59-
<section id="a%Version%-breaking" name="Breaking Changes">
60-
</section>
61-
<br/>
62-
Apache log4net %Version% addresses reported issues:
63-
<section id="a%Version%-bug" name="Bug fixes">
64-
<ul>
65-
<li>
66-
<a href="https://github.com/apache/logging-log4net/issues/tbd">tbd</a> (by tbd)
67-
</li>
68-
</ul>
69-
</section>
70-
<section id="a%Version%-enhancements" name="Enhancements">
71-
<ul>
72-
<li>
73-
<a href="https://github.com/apache/logging-log4net/issues/tbd">tbd</a> (by tbd)
74-
</li>
75-
</ul>
76-
</section>
77-
</section>'
57+
$ReleaseNoteXml = '
58+
<?xml version="1.0" encoding="UTF-8"?>
59+
<release xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
60+
xmlns="https://logging.apache.org/xml/ns"
61+
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
62+
date="~Date~"
63+
version="~Version~"/>'.Replace('~Version~', $NewVersion).Replace('~Date~', (Get-Date).AddMonths(2).ToString('yyyy-MM-dd'))
7864

79-
#Update-ReleaseNotes $PSScriptRoot/../src/site/xdoc/release/release-notes.xml $ReleaseNoteSection $NewVersion
65+
New-ReleaseNotes $ReleaseNoteXml $NewVersion

0 commit comments

Comments
 (0)