Skip to content

Commit

Permalink
ci: set conditional dependency of PublishToGitHub target on `Genera…
Browse files Browse the repository at this point in the history
…teAssemblyInfo` to fix publishing to GitHub
  • Loading branch information
xperiandri committed Nov 22, 2024
1 parent f9fdff4 commit f21c1f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
30 changes: 20 additions & 10 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,17 @@ let watchDocs ctx =
DocsTool.watch (string configuration)


let initTargets () =
let initTargets (ctx : Context.FakeExecutionContext) =
BuildServer.install [ GitHubActions.Installer ]

let isPublishToGitHub =
ctx.Arguments
|> Seq.pairwise
|> Seq.exists (fun (arg, value) ->
(String.Equals (arg, "-t", StringComparison.OrdinalIgnoreCase)
|| String.Equals (arg, "--target", StringComparison.OrdinalIgnoreCase))
&& String.Equals (value, "PublishToGitHub", StringComparison.OrdinalIgnoreCase))

/// Defines a dependency - y is dependent on x. Finishes the chain.
let (==>!) x y = x ==> y |> ignore

Expand Down Expand Up @@ -651,7 +659,7 @@ let initTargets () =
==>! "ShowCoverageReport"

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

Expand All @@ -664,8 +672,9 @@ let initTargets () =
==> "GitHubRelease"
==>! "Publish"

"DotnetRestore" =?> ("CheckFormatCode", isCI.Value)
==> "GenerateAssemblyInfo"
"DotnetRestore"
=?> ("CheckFormatCode", isCI.Value)
=?> ("GenerateAssemblyInfo", isPublishToGitHub)
==> "DotnetBuild"
==> "DotnetTest"
==> "DotnetPack"
Expand All @@ -678,13 +687,14 @@ let initTargets () =
//-----------------------------------------------------------------------------
[<EntryPoint>]
let main argv =
argv
|> Array.toList
|> Context.FakeExecutionContext.Create false "build.fsx"
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext

initTargets ()
let ctx =
argv
|> Array.toList
|> Context.FakeExecutionContext.Create false "build.fsx"

Context.setExecutionContext (Context.RuntimeContext.Fake ctx)
initTargets ctx
Target.runOrDefaultWithArguments "DotnetPack"

0 // return an integer exit code
8 changes: 4 additions & 4 deletions src/FSharp.Control.R3/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("FSharp.Control.R3")>]
[<assembly: AssemblyProductAttribute("FSharp.Control.R3")>]
[<assembly: AssemblyVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseDate","2017-03-17T00:00:00.0000000")>]
[<assembly: AssemblyMetadataAttribute("ReleaseDate","2024-11-18T00:00:00.0000000")>]
[<assembly: AssemblyFileVersionAttribute("0.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseChannel","release")>]
[<assembly: AssemblyMetadataAttribute("GitHash","bb8964b54bee133e9af64d316dc2cfee16df7f72")>]
[<assembly: AssemblyMetadataAttribute("GitHash","7accd8a9a4e8434e48b501db88ddac111f40e1a5")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "FSharp.Control.R3"
let [<Literal>] AssemblyProduct = "FSharp.Control.R3"
let [<Literal>] AssemblyVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseDate = "2017-03-17T00:00:00.0000000"
let [<Literal>] AssemblyMetadata_ReleaseDate = "2024-11-18T00:00:00.0000000"
let [<Literal>] AssemblyFileVersion = "0.1.0"
let [<Literal>] AssemblyInformationalVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseChannel = "release"
let [<Literal>] AssemblyMetadata_GitHash = "bb8964b54bee133e9af64d316dc2cfee16df7f72"
let [<Literal>] AssemblyMetadata_GitHash = "7accd8a9a4e8434e48b501db88ddac111f40e1a5"

0 comments on commit f21c1f7

Please sign in to comment.