Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep unreleased changelog section when promote to new version #2480

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/app/Fake.Core.ReleaseNotes/Changelog.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/// Contains helpers which allow to parse Change log text files.
/// These files have to be in a format as described on http://keepachangelog.com/en/1.1.0/
///
/// ## Format
///
/// ```markdown
/// # Changelog
///
/// All notable changes to this project will be documented in this file.
///
/// The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
/// and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
///
/// ## [Unreleased]
///
/// ## [0.1.0] - 2020-03-17
/// First release
///
/// ### Added
/// - This release already has lots of features
///
/// [0.1.0]: https://github.com/user/MyCoolNewLib.git/releases/tag/v0.1.0
/// ```
///
/// ## Sample
///
/// let changelogFile = "CHANGELOG.md"
Expand Down Expand Up @@ -216,9 +237,9 @@ type Changelog =
match x.Unreleased with
| None -> x
| Some u ->
let newEntry = ChangelogEntry.New(assemblyVersion, nugetVersion, Some (System.DateTime.Today), u.Description, u.Changes, false)

Changelog.New(x.Header, x.Description, None, newEntry :: x.Entries)
let newEntry = ChangelogEntry.New(assemblyVersion, nugetVersion, Some DateTime.Today, u.Description, u.Changes, false)
let unreleased' = Some { Description = None; Changes = [] }
Changelog.New(x.Header, x.Description, unreleased', newEntry :: x.Entries)

member x.PromoteUnreleased(version: string) : Changelog =
let assemblyVersion, nugetVersion = version |> parseVersions
Expand Down