Skip to content

Commit 0e0bd4f

Browse files
authored
Merge pull request #30 from akkadotnet/nugetpublish
Nuget publish script
2 parents 0971e36 + 58578d3 commit 0e0bd4f

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

build.fsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ open Fake.DocFxHelper
1313
let configuration = "Release"
1414

1515
// Directories
16-
let output = __SOURCE_DIRECTORY__ @@ "build"
16+
let output = __SOURCE_DIRECTORY__ @@ "bin"
1717
let outputTests = output @@ "tests"
1818
let outputBinaries = output @@ "binaries"
1919
let outputNuGet = output @@ "nuget"
@@ -60,13 +60,41 @@ Target "CreateNuget" (fun _ ->
6060
DotNetCli.Pack
6161
(fun p ->
6262
{ p with
63-
Project = "./**/Akka.Logger.Serilog.csproj"
63+
Project = "./src/Akka.Logger.Serilog/Akka.Logger.Serilog.csproj"
6464
Configuration = configuration
6565
AdditionalArgs = ["--include-symbols"]
6666
VersionSuffix = versionSuffix
6767
OutputPath = outputNuGet })
6868
)
6969

70+
Target "PublishNuget" (fun _ ->
71+
let projects = !! "./bin/nuget/*.nupkg" -- "./bin/nuget/*.symbols.nupkg"
72+
let apiKey = getBuildParamOrDefault "nugetkey" ""
73+
let source = getBuildParamOrDefault "nugetpublishurl" ""
74+
let symbolSource = getBuildParamOrDefault "symbolspublishurl" ""
75+
let shouldPublishSymbolsPackages = not (symbolSource = "")
76+
77+
if (not (source = "") && not (apiKey = "") && shouldPublishSymbolsPackages) then
78+
let runSingleProject project =
79+
DotNetCli.RunCommand
80+
(fun p ->
81+
{ p with
82+
TimeOut = TimeSpan.FromMinutes 10. })
83+
(sprintf "nuget push %s --api-key %s --source %s --symbol-source %s" project apiKey source symbolSource)
84+
85+
projects |> Seq.iter (runSingleProject)
86+
else if (not (source = "") && not (apiKey = "") && not shouldPublishSymbolsPackages) then
87+
let runSingleProject project =
88+
DotNetCli.RunCommand
89+
(fun p ->
90+
{ p with
91+
TimeOut = TimeSpan.FromMinutes 10. })
92+
(sprintf "nuget push %s --api-key %s --source %s" project apiKey source)
93+
94+
projects |> Seq.iter (runSingleProject)
95+
)
96+
97+
7098
//--------------------------------------------------------------------------------
7199
// Target dependencies
72100
//--------------------------------------------------------------------------------
@@ -80,6 +108,7 @@ Target "Nuget" DoNothing
80108

81109
// nuget dependencies
82110
"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
111+
"CreateNuget" ==> "PublishNuget" ==> "Nuget"
83112

84113
// all
85114
"BuildRelease" ==> "All"

0 commit comments

Comments
 (0)