From ecb2582f7ae41c804e6641241af26e09f6464b4f Mon Sep 17 00:00:00 2001 From: Florian Lorenzen Date: Tue, 17 Oct 2023 22:04:19 +0200 Subject: [PATCH] Push packages to nuget.org --- build/Build.fs | 31 ++++++++++++++++--------------- build/build.fsproj | 1 + 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/build/Build.fs b/build/Build.fs index 5b7f378..28b0a69 100644 --- a/build/Build.fs +++ b/build/Build.fs @@ -1,6 +1,7 @@ open System open Fake.Core open Fake.DotNet +open Fake.DotNet.NuGet open Fake.Tools open Fake.IO open Fake.IO.FileSystemOperators @@ -95,8 +96,6 @@ let mutable latestEntry = let mutable changelogBackupFilename = "" -let publishUrl = "https://www.nuget.org" - let enableCodeCoverage = environVarAsBoolOrDefault "ENABLE_COVERAGE" true let githubToken = Environment.environVarOrNone "GITHUB_TOKEN" @@ -453,19 +452,21 @@ let sourceLinkTest _ = !!distGlob |> Seq.iter (fun nupkg -> dotnet.sourcelink id (sprintf "test %s" nupkg)) -let publishToNuget _ = allPublishChecks () - -// TODO w/o paket -// Paket.push (fun c -> { -// c with -// ToolType = ToolType.CreateLocalTool() -// PublishUrl = publishUrl -// WorkingDir = "dist" -// ApiKey = -// match nugetToken with -// | Some s -> s -// | _ -> c.ApiKey // assume paket-config was set properly -// }) +let publishToNuget _ = + allPublishChecks () + + match nugetToken with + | None -> failwith "missing nugetToken" + | _ -> () + + let setNugetPushParams (c: NuGet.NuGet.NuGetPushParams) = { c with ApiKey = nugetToken } + + !!distGlob + |> Seq.iter ( + DotNet.nugetPush (fun (c: DotNet.NuGetPushOptions) -> + { c with + PushParams = setNugetPushParams c.PushParams }) + ) let gitRelease _ = allReleaseChecks () diff --git a/build/build.fsproj b/build/build.fsproj index d436342..ccd5186 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -19,6 +19,7 @@ +