Skip to content

Commit

Permalink
ci: fix release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Nov 22, 2024
1 parent f033c2c commit 093ef8d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# 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]
- Some basic functions added: `filter`, `bind`, `concat`, `distinct`, `mapi`, `skip`, `take`, ...
- rxquery { ... } builder added

- Added some basic functions: `filter/where`, `bind`, `concat`, `distinct`, `mapi`, `skip`, `take`, …
- Added `rxquery { … }` builder

## [0.1.0] - 2024-11-18
First pre-release
Expand All @@ -15,4 +17,4 @@ First pre-release
- Initial implementation of the library
- `map`, `iter` and `length` functions

[0.1.0]: https://github.com/fsprojects/FSharp.Control.R3/releases/tag/v0.1.0
[0.1.0]: https://github.com/fsprojects/FSharp.Control.R3/releases/tag/releases/0.1.0
4 changes: 2 additions & 2 deletions build/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let isEmptyChange =
| Changelog.Change.Security s
| Changelog.Change.Custom (_, s) -> String.IsNullOrWhiteSpace s.CleanedText

let tagFromVersionNumber versionNumber = sprintf "v%s" versionNumber
let tagFromVersionNumber versionNumber = sprintf "releases/%s" versionNumber

let failOnEmptyChangelog (latestEntry : Changelog.ChangelogEntry) =
let isEmpty =
Expand All @@ -27,7 +27,7 @@ let failOnEmptyChangelog (latestEntry : Changelog.ChangelogEntry) =
let mkLinkReference (newVersion : SemVerInfo) (changelog : Changelog.Changelog) (gitHubRepoUrl : string) =
if changelog.Entries |> List.isEmpty then
// No actual changelog entries yet: link reference will just point to the Git tag
sprintf "[%s]: %s/releases/tag/%s" newVersion.AsString (gitHubRepoUrl.TrimEnd ('/')) (tagFromVersionNumber newVersion.AsString)
sprintf "[%s]: %s/releases/tag/%s" newVersion.AsString gitHubRepoUrl (tagFromVersionNumber newVersion.AsString)
else
let versionTuple version = (version.Major, version.Minor, version.Patch)
// Changelog entries come already sorted, most-recent first, by the Changelog module
Expand Down
4 changes: 4 additions & 0 deletions build/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"BuildDocs": {
"commandName": "Project",
"commandLineArgs": "--target BuildDocs"
},
"Release": {
"commandName": "Project",
"commandLineArgs": "--target Release 0.2.0"
}
}
}
17 changes: 8 additions & 9 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ let watchDocsDir = temp </> "watch-docs"
let gitOwner = "fsprojects"
let gitRepoName = "FSharp.Control.R3"

let gitHubRepoUrl = $"https://github.com/%s{gitOwner}/%s{gitRepoName}/"
let gitHubRepoUrl = $"https://github.com/%s{gitOwner}/%s{gitRepoName}"

let documentationRootUrl = $"https://%s{gitOwner}.github.io/%s{gitRepoName}/"
let documentationRootUrl = $"https://%s{gitOwner}.github.io/%s{gitRepoName}"

let releaseBranch = "main"
let readme = "README.md"
Expand Down Expand Up @@ -190,7 +190,7 @@ module DocsTool =
Parameters =
Some [
// https://fsprojects.github.io/FSharp.Formatting/content.html#Templates-and-Substitutions
"root", quoted documentationRootUrl
"root", quoted $"{documentationRootUrl}/"
"fsdocs-collection-name", quoted productName
"fsdocs-repository-branch", quoted releaseBranch
"fsdocs-package-version", quoted latestEntry.NuGetVersion
Expand All @@ -200,7 +200,6 @@ module DocsTool =
Strict = Some true
}


let cleanDocsCache () = Fsdocs.cleanCache rootDirectory

let build (configuration) = Fsdocs.build fsDocsDotnetOptions (fsDocsBuildParams configuration)
Expand All @@ -216,9 +215,8 @@ module DocsTool =

Fsdocs.watch fsDocsDotnetOptions (fun p -> { p with BuildCommandParams = Some (buildParams p.BuildCommandParams) })

let allReleaseChecks () =
failOnWrongBranch ()
Changelog.failOnEmptyChangelog latestEntry
let allReleaseChecks () = failOnWrongBranch ()
//Changelog.failOnEmptyChangelog latestEntry


let failOnLocalBuild () =
Expand Down Expand Up @@ -507,7 +505,7 @@ let gitRelease _ =
++ (rootDirectory </> "tests/**/AssemblyInfo.fs")
|> Seq.iter (Git.Staging.stageFile "" >> ignore)

let msg = sprintf "Bump version to %s\n\n%s" latestEntry.NuGetVersion releaseNotesGitCommitFormat
let msg = $"Bump version to `%s{latestEntry.NuGetVersion}`\n\n%s{releaseNotesGitCommitFormat}"

Git.Commit.exec "" msg

Expand All @@ -526,7 +524,7 @@ let githubRelease _ =
let token =
match githubToken with
| Some s -> s
| _ -> failwith "please set the github_token environment variable to a github personal access token with repo access."
| _ -> failwith "please set the `GITHUB_TOKEN` environment variable to a github personal access token with repo access."

let files = !!distGlob
// Get release notes with properly-linked version number
Expand Down Expand Up @@ -664,6 +662,7 @@ let initTargets () =
==>! "Publish"

"DotnetRestore" =?> ("CheckFormatCode", isCI.Value)
==> "GenerateAssemblyInfo"
==> "DotnetBuild"
==> "DotnetTest"
==> "DotnetPack"
Expand Down

0 comments on commit 093ef8d

Please sign in to comment.