@@ -573,9 +573,17 @@ let watchDocs ctx =
573573 DocsTool.watch ( string configuration)
574574
575575
576- let initTargets () =
576+ let initTargets ( ctx : Context.FakeExecutionContext ) =
577577 BuildServer.install [ GitHubActions.Installer ]
578578
579+ let isPublishToGitHub =
580+ ctx.Arguments
581+ |> Seq.pairwise
582+ |> Seq.exists ( fun ( arg , value ) ->
583+ ( String.Equals ( arg, " -t" , StringComparison.OrdinalIgnoreCase)
584+ || String.Equals ( arg, " --target" , StringComparison.OrdinalIgnoreCase))
585+ && String.Equals ( value, " PublishToGitHub" , StringComparison.OrdinalIgnoreCase))
586+
579587 /// Defines a dependency - y is dependent on x. Finishes the chain.
580588 let (= =>!) x y = x ==> y |> ignore
581589
@@ -651,7 +659,7 @@ let initTargets () =
651659 ==>! " ShowCoverageReport"
652660
653661 " UpdateChangelog"
654- ==> " GenerateAssemblyInfo"
662+ =?> ( " GenerateAssemblyInfo" , not isPublishToGitHub )
655663 ==> " GitRelease"
656664 ==>! " Release"
657665
@@ -664,8 +672,9 @@ let initTargets () =
664672 ==> " GitHubRelease"
665673 ==>! " Publish"
666674
667- " DotnetRestore" =?> ( " CheckFormatCode" , isCI.Value)
668- ==> " GenerateAssemblyInfo"
675+ " DotnetRestore"
676+ =?> ( " CheckFormatCode" , isCI.Value)
677+ =?> ( " GenerateAssemblyInfo" , isPublishToGitHub)
669678 ==> " DotnetBuild"
670679 ==> " DotnetTest"
671680 ==> " DotnetPack"
@@ -678,13 +687,14 @@ let initTargets () =
678687//-----------------------------------------------------------------------------
679688[<EntryPoint>]
680689let main argv =
681- argv
682- |> Array.toList
683- |> Context.FakeExecutionContext.Create false " build.fsx"
684- |> Context.RuntimeContext.Fake
685- |> Context.setExecutionContext
686690
687- initTargets ()
691+ let ctx =
692+ argv
693+ |> Array.toList
694+ |> Context.FakeExecutionContext.Create false " build.fsx"
695+
696+ Context.setExecutionContext ( Context.RuntimeContext.Fake ctx)
697+ initTargets ctx
688698 Target.runOrDefaultWithArguments " DotnetPack"
689699
690700 0 // return an integer exit code
0 commit comments