When preparing a software release, a common task is to parse the changelog file, and extract the latest changes section from it. For certain purposes, Markdown format is acceptable, but in some cases a text format is also useful.
ChangelogAutomation is a tool for this exact purpose. It will extract the first second-level section from a Markdown file either in a text or in a Markdown format, and will print it to a file or to its stdout.
"Second-level section" is a section preceded by a level 2 header; any of these:
## Level 2 header
…some section content…
Also level 2 header
-------------------
…some section content…If you use the standalone tool (see below), then ChangelogAutomation will require the .NET 9 dependencies (but not the .NET 9 runtime itself) to be available on the user machine to run. See more information in the documentation.
There's a separate repository with GitHub Action integration of this tool. Check out the documentation.
ChangelogAutomation is available for installation in two variants:
- as a .NET tool:
$ dotnet tool install --global ChangelogAutomation.Tool - as a standalone native tool for several operating systems on the GitHub releases page.
Then you can run the tool using:
$ ChangelogAutomation <path-to-input-file> [options…]This invocation will extract the first second-level section of the file and write it to the output (either the standard output or an optional output file).
The available options are:
(-o|--output-file-path) <output-file-path>(if not specified, then will print to stdout)(-t|--content-type) (Markdown|PlainText): output content type
There's an MSBuild task package available. The package will automatically integrate with dotnet pack, and extract the latest changelog entry into the <releaseNotes> element in the .nuspec file.
Just add a package reference to ChangelogAutomation.MSBuild package, and the task will automatically be enabled. It will set the PackageReleaseNotes property to the latest version section contents (this is a standard property, will then be used by NuGet integration automatically).
There are MSBuild properties to tune its behavior:
DisableChangelogAutomationTask: set this totrueto disable the automatic task invocation (if you want to register it with the custom parameters).ChangelogFilePath: point it to theCHANGELOG.mdfile. By default, will be set to../CHANGELOG.md(resolved relatively to the project file location).ReleaseNotesOutputType: eitherMarkdownorPlainText. If not set, defaults toPlainText.
ChangelogAutomation is a .NET 9 application, so it requires .NET 9 SDK (or a later version) for build.
To build the application, run the following command:
$ dotnet build --configuration ReleaseTo run the unit test suite, run the following command:
$ dotnet test --configuration ReleaseTo run the integration test for the MSBuild task package, run the following command:
$ pwsh ./ChangelogAutomation.MSBuild.Tests/Run-Test.ps1To verify the NuGet package produced for ChangelogAutomation.MSBuild, run the following command:
$ pwsh ./ChangelogAutomation.MSBuild.Tests/Run-PackageValidation.ps1To run the developer version, execute the following command (usual application arguments follow after --):
$ dotnet run --project ChangelogAutomation -- …The project is distributed under the terms of the MIT license.
The license indication in the project's sources is compliant with the REUSE specification v3.3.