Skip to content

Commit

Permalink
Fixes #192
Browse files Browse the repository at this point in the history
This ensures we fail on release if there are no changelog changes
  • Loading branch information
Jimmy Byrd committed Feb 24, 2020
1 parent c0db8e6 commit d6df096
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
13 changes: 12 additions & 1 deletion Content/Console/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ let isEmptyChange = function
| Changelog.Change.Custom (_, s) ->
String.IsNullOrWhiteSpace s.CleanedText

let isChangelogEmpty () =
let isEmpty =
(latestEntry.Changes |> Seq.forall isEmptyChange)
|| latestEntry.Changes |> Seq.isEmpty
if isEmpty then failwith "No changes in CHANGELOG. Please add your changes under a heading specified in https://keepachangelog.com/"

let allReleaseChecks () =
isReleaseBranchCheck ()
isChangelogEmpty ()

let mkLinkReference (newVersion : SemVerInfo) (changelog : Changelog.Changelog) =
if changelog.Entries |> List.isEmpty then
// No actual changelog entries yet: link reference will just point to the Git tag
Expand Down Expand Up @@ -465,7 +475,7 @@ let createPackages _ =
)

let gitRelease _ =
isReleaseBranchCheck ()
allReleaseChecks ()

let releaseNotesGitCommitFormat = latestEntry.ToString()

Expand All @@ -481,6 +491,7 @@ let gitRelease _ =
Target.deactivateBuildFailure "RevertChangelog"

let githubRelease _ =
allReleaseChecks ()
let token =
match Environment.environVarOrDefault "GITHUB_TOKEN" "" with
| s when not (String.IsNullOrWhiteSpace s) -> s
Expand Down
18 changes: 15 additions & 3 deletions Content/Library/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ let isEmptyChange = function
| Changelog.Change.Custom (_, s) ->
String.IsNullOrWhiteSpace s.CleanedText

let isChangelogEmpty () =
let isEmpty =
(latestEntry.Changes |> Seq.forall isEmptyChange)
|| latestEntry.Changes |> Seq.isEmpty
if isEmpty then failwith "No changes in CHANGELOG. Please add your changes under a heading specified in https://keepachangelog.com/"

let allReleaseChecks () =
isReleaseBranchCheck ()
isChangelogEmpty ()


let mkLinkReference (newVersion : SemVerInfo) (changelog : Changelog.Changelog) =
if changelog.Entries |> List.isEmpty then
// No actual changelog entries yet: link reference will just point to the Git tag
Expand Down Expand Up @@ -498,7 +509,7 @@ let sourceLinkTest _ =
)

let publishToNuget _ =
isReleaseBranchCheck ()
allReleaseChecks ()
Paket.push(fun c ->
{ c with
ToolType = ToolType.CreateLocalTool()
Expand All @@ -510,7 +521,7 @@ let publishToNuget _ =
Target.deactivateBuildFailure "RevertChangelog"

let gitRelease _ =
isReleaseBranchCheck ()
allReleaseChecks ()

let releaseNotesGitCommitFormat = latestEntry.ToString()

Expand All @@ -524,6 +535,7 @@ let gitRelease _ =
Git.Branches.pushTag "" "origin" tag

let githubRelease _ =
allReleaseChecks ()
let token =
match Environment.environVarOrDefault "GITHUB_TOKEN" "" with
| s when not (String.IsNullOrWhiteSpace s) -> s
Expand Down Expand Up @@ -577,7 +589,7 @@ let watchDocs _ =
DocsTool.watch ()

let releaseDocs ctx =
isReleaseBranchCheck ()
isReleaseBranchCheck () // Docs changes don't need a full release to the library

Git.Staging.stageAll docsDir
Git.Commit.exec "" (sprintf "Documentation release of version %s" latestEntry.NuGetVersion)
Expand Down
17 changes: 15 additions & 2 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ let isEmptyChange = function
| Changelog.Change.Custom (_, s) ->
String.IsNullOrWhiteSpace s.CleanedText

let isChangelogEmpty () =
let isEmpty =
(latestEntry.Changes |> Seq.forall isEmptyChange)
|| latestEntry.Changes |> Seq.isEmpty
if isEmpty then failwith "No changes in CHANGELOG. Please add your changes under a heading specified in https://keepachangelog.com/"

let allReleaseChecks () =
isReleaseBranchCheck ()
isChangelogEmpty ()

let mkLinkReference (newVersion : SemVerInfo) (changelog : Changelog.Changelog) =
if changelog.Entries |> List.isEmpty then
// No actual changelog entries yet: link reference will just point to the Git tag
Expand Down Expand Up @@ -355,6 +365,7 @@ let ``integration tests`` ctx =
}) proj)

let publish _ =
allReleaseChecks ()
Paket.push(fun c ->
{ c with
ToolType = ToolType.CreateLocalTool()
Expand All @@ -364,7 +375,7 @@ let publish _ =
)

let ``git release`` _ =
isReleaseBranchCheck ()
allReleaseChecks ()

let releaseNotesGitCommitFormat = latestEntry.ToString()

Expand All @@ -379,6 +390,8 @@ let ``git release`` _ =


let ``github release`` _ =
allReleaseChecks ()

let token =
match Environment.environVarOrDefault "GITHUB_TOKEN" "" with
| s when not (String.IsNullOrWhiteSpace s) -> s
Expand All @@ -402,7 +415,7 @@ let ``watch docs`` _ =
DocsTool.watch ()

let ``release docs`` ctx =
isReleaseBranchCheck ()
isReleaseBranchCheck () // Docs changes don't need a full release to the library

Git.Staging.stageAll docsDir
Git.Commit.exec "" (sprintf "Documentation release of version %s" latestEntry.NuGetVersion)
Expand Down

0 comments on commit d6df096

Please sign in to comment.