Skip to content

Commit

Permalink
ci: implemented incrementing patch version on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Nov 22, 2024
1 parent f21c1f7 commit cd75431
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ let failOnBadExitAndPrint (p : ProcessResult) =

failwithf "failed with exitcode %d" p.ExitCode

let isPublishToGitHub ctx = ctx.Context.FinalTarget = "PublishToGitHub"

let isCI = lazy environVarAsBoolOrDefault "CI" false

Expand Down Expand Up @@ -266,7 +267,20 @@ let dotnetRestore _ =
|> Seq.iter (retryIfInCI 10)

let updateChangelog ctx =
latestEntry <- Changelog.updateChangelog changelogPath changelog gitHubRepoUrl ctx
latestEntry <-
if not <| isPublishToGitHub ctx then
Changelog.updateChangelog changelogPath changelog gitHubRepoUrl ctx
else
let latest = changelog.LatestEntry
{
latest with
SemVer = {
latest.SemVer with
Patch = latest.SemVer.Patch + 1u
PreRelease = PreRelease.TryParse "ci"
}
}
printf ""

let revertChangelog _ =
if String.isNotNullOrEmpty Changelog.changelogBackupFilename then
Expand All @@ -286,7 +300,7 @@ let getPackageVersionProperty publishToGitHub =

let dotnetBuild ctx =

let publishToGitHub = ctx.Context.FinalTarget = "PublishToGitHub"
let publishToGitHub = isPublishToGitHub ctx

let args = [ getPackageVersionProperty publishToGitHub; "--no-restore" ]

Expand Down Expand Up @@ -447,10 +461,7 @@ let dotnetPack ctx =
// Get release notes with properly-linked version number
let releaseNotes = Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl

let args = [
getPackageVersionProperty (ctx.Context.FinalTarget = "PublishToGitHub")
$"/p:PackageReleaseNotes=\"{releaseNotes}\""
]
let args = [ getPackageVersionProperty (isPublishToGitHub ctx); $"/p:PackageReleaseNotes=\"{releaseNotes}\"" ]

DotNet.pack
(fun c -> {
Expand Down Expand Up @@ -659,7 +670,7 @@ let initTargets (ctx : Context.FakeExecutionContext) =
==>! "ShowCoverageReport"

"UpdateChangelog"
=?> ("GenerateAssemblyInfo", not isPublishToGitHub)
==> "GenerateAssemblyInfo"
==> "GitRelease"
==>! "Release"

Expand Down

0 comments on commit cd75431

Please sign in to comment.