From 9ef95b8a81b147ec902c12978fbf9ce5b42fe449 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sun, 15 Jun 2014 15:20:29 +0200 Subject: [PATCH] Build: publish NuGet packages to nuget.org and symbolsource.com --- build.fsx | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/build.fsx b/build.fsx index 0deb58fb..29d8ef64 100644 --- a/build.fsx +++ b/build.fsx @@ -461,7 +461,7 @@ Target "Api" (fun _ -> // -------------------------------------------------------------------------------------- -// Release/Publishing +// Publishing // Requires permissions; intended only for maintainers // -------------------------------------------------------------------------------------- @@ -498,18 +498,44 @@ Target "PublishApi" (fun _ -> Git.Commit.Commit repo (sprintf "Numerics: %s api update" packageVersion) Git.Branches.pushBranch repo "origin" "master") +let publishNuGet packageFiles = + // TODO: Migrate to NuGet helper once it supports direct (non-integrated) operations + let rec impl trials file = + trace ("NuGet Push: " + System.IO.Path.GetFileName(file) + ".") + try + let args = sprintf "push \"%s\"" (FullName file) + let result = + ExecProcess (fun info -> + info.FileName <- "tools/NuGet/NuGet.exe" + info.WorkingDirectory <- FullName "obj/NuGet" + info.Arguments <- args) (TimeSpan.FromMinutes 10.) + if result <> 0 then failwith "Error during NuGet push." + with exn -> + if trials > 0 then impl (trials-1) file + else raise exn + Seq.iter (impl 3) packageFiles + +Target "PublishNuGet" (fun _ -> + !! "out/packages/NuGet/*.nupkg" -- "out/packages/NuGet/*.symbols.nupkg" |> publishNuGet + !! "out/packages/NuGet/*.symbols.nupkg" |> publishNuGet) +Target "NativePublishNuGet" (fun _ -> !! "out/MKL/packages/NuGet/*.symbols.nupkg" |> publishNuGet) +Target "DataPublishNuGet" (fun _ -> !! "out/Data/packages/NuGet/*.symbols.nupkg" |> publishNuGet) + Target "Publish" DoNothing "PublishTag" ==> "Publish" +"PublishNuGet" ==> "Publish" "PublishDocs" ==> "Publish" "PublishApi" ==> "Publish" Target "NativePublish" DoNothing "NativePublishTag" ==> "NativePublish" +"NativePublishNuGet" ==> "NativePublish" "PublishDocs" ==> "NativePublish" "PublishApi" ==> "NativePublish" Target "DataPublish" DoNothing -"DataPublishTag" ==> "DataPublish" +"DataPublishTag" ==> "DataPublish +"DataPublishNuGet" ==> "DataPublish" "PublishDocs" ==> "DataPublish" "PublishApi" ==> "DataPublish"