Skip to content

Commit 948b597

Browse files
committed
#181 added script for bumping version
- added MailTemplate for announcement
1 parent 56edca6 commit 948b597

File tree

3 files changed

+92
-8
lines changed

3 files changed

+92
-8
lines changed

doc/MailTemplate.Announce.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
Subject: [ANNOUNCE] Apache log4net 3.0.0 released
3+
4+
Hi,
5+
6+
the Apache log4net team is pleased to announce the 3.0.0 release.
7+
For further information (support, download, etc.) see
8+
- https://logging.apache.org/log4net/release/release-notes.html
9+
- https://github.com/apache/logging-log4net/releases/tag/rel%2F3.0.0
10+
- https://www.nuget.org/packages/log4net/3.0.0
11+
12+
== Release Notes
13+

scripts/update-version.ps1

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Param (
2+
[Parameter()]
3+
[ValidateNotNullOrEmpty()]
4+
[string]$OldVersion = '3.0.0',
5+
[Parameter()]
6+
[ValidateNotNullOrEmpty()]
7+
[string]$NewVersion = '3.1.0'
8+
)
9+
10+
Set-StrictMode -Version Latest
11+
$ErrorActionPreference = 'Stop'
12+
13+
function Update-XmlVersion([System.IO.FileInfo]$XmlFile, [string]$Version, [string]$NodePath)
14+
{
15+
[Xml]$XmlContent = Get-Content $XmlFile
16+
$Node = $XmlContent.SelectSingleNode($NodePath)
17+
$Node.InnerText = $Version
18+
"$($Node.OuterXml)"
19+
$XmlContent.Save($XmlFile)
20+
}
21+
22+
function Update-JsonVersion([System.IO.FileInfo]$JsonFile, [string]$Version)
23+
{
24+
$JsonContent = Get-Content $JsonFile | ConvertFrom-Json
25+
$JsonContent.version = $Version
26+
"$($JsonFile): $($JsonContent.version)"
27+
$JsonContent | ConvertTo-Json | Out-File $JsonFile
28+
}
29+
30+
function Update-TextVersion([System.IO.FileInfo]$TextFile, [string]$OldVersion, [string]$NewVersion)
31+
{
32+
$OldContent = Get-Content $TextFile | Out-String
33+
$NewContent = $OldContent.Replace($OldVersion, $NewVersion)
34+
"$($TextFile): $NewVersion"
35+
$NewContent | Out-File $TextFile
36+
}
37+
38+
function Update-ReleaseNotes([System.IO.FileInfo]$XmlFile, [string]$Content, [string]$Version)
39+
{
40+
[Xml]$XmlContent = Get-Content $XmlFile
41+
$NewChild = New-Object System.Xml.XmlDocument
42+
$NewChild.LoadXml($Content.Replace('%Version%', $Version))
43+
$Node = $XmlContent.SelectSingleNode('/document/body/section')
44+
$Node.PrependChild($XmlContent.ImportNode($NewChild.DocumentElement, $true))
45+
"$($XmlFile): $NewVersion"
46+
$XmlContent.Save($XmlFile)
47+
}
48+
49+
Update-XmlVersion $PSScriptRoot/../pom.xml $NewVersion '/*[local-name()="project"]/*[local-name()="version"]'
50+
Update-JsonVersion $PSScriptRoot/../package.json $NewVersion
51+
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.txt $OldVersion $NewVersion
52+
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.Result.txt $OldVersion $NewVersion
53+
Update-TextVersion $PSScriptRoot/../doc/MailTemplate.Announce.txt $OldVersion $NewVersion
54+
Update-XmlVersion $PSScriptRoot/../src/log4net/log4net.csproj $NewVersion '/Project/PropertyGroup/Version'
55+
56+
$ReleaseNoteSection = '
57+
<section id="a%Version%" name="%Version%">
58+
<section id="a%Version%-breaking" name="Breaking Changes">
59+
</section>
60+
<br/>
61+
Apache log4net %Version% addresses reported issues:
62+
<section id="a%Version%-bug" name="Bug fixes">
63+
<ul>
64+
<li>
65+
<a href="https://github.com/apache/logging-log4net/issues/tbd">tbd</a> (by tbd)
66+
</li>
67+
</ul>
68+
</section>
69+
<section id="a%Version%-enhancements" name="Enhancements">
70+
<ul>
71+
<li>
72+
<a href="https://github.com/apache/logging-log4net/issues/tbd">tbd</a> (by tbd)
73+
</li>
74+
</ul>
75+
</section>
76+
</section>'
77+
78+
Update-ReleaseNotes $PSScriptRoot/../src/site/xdoc/release/release-notes.xml $ReleaseNoteSection $NewVersion

src/log4net.sln

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".doc", ".doc", "{33D80AD3-8
4343
..\doc\BUILDING.md = ..\doc\BUILDING.md
4444
site\xdoc\release\config-examples.xml = site\xdoc\release\config-examples.xml
4545
site\xdoc\download_log4net.xml = site\xdoc\download_log4net.xml
46+
..\doc\MailTemplate.Announce.txt = ..\doc\MailTemplate.Announce.txt
4647
..\doc\MailTemplate.Result.txt = ..\doc\MailTemplate.Result.txt
4748
..\doc\MailTemplate.txt = ..\doc\MailTemplate.txt
4849
site\xdoc\release\release-notes.xml = site\xdoc\release\release-notes.xml
4950
..\doc\RELEASING.md = ..\doc\RELEASING.md
5051
EndProjectSection
5152
EndProject
52-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".scripts", ".scripts", "{050E0D0D-D916-42FD-AE58-32965336D357}"
53-
ProjectSection(SolutionItems) = preProject
54-
..\scripts\build-preview.ps1 = ..\scripts\build-preview.ps1
55-
..\scripts\install-dotnet-sdk.ps1 = ..\scripts\install-dotnet-sdk.ps1
56-
..\scripts\sign-log4net-libraries.ps1 = ..\scripts\sign-log4net-libraries.ps1
57-
..\scripts\sign-log4net-libraries.sh = ..\scripts\sign-log4net-libraries.sh
58-
EndProjectSection
59-
EndProject
6053
Global
6154
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6255
Debug|Any CPU = Debug|Any CPU

0 commit comments

Comments
 (0)