Skip to content

Commit

Permalink
Push packages to nuget.org
Browse files Browse the repository at this point in the history
  • Loading branch information
florenzen committed Oct 17, 2023
1 parent 3b8c814 commit ecb2582
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
31 changes: 16 additions & 15 deletions build/Build.fs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 ()
Expand Down
1 change: 1 addition & 0 deletions build/build.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<PackageReference Include="Fake.Core.Target" Version="6.0.0" />
<PackageReference Include="Fake.DotNet.AssemblyInfoFile" Version="6.0.0" />
<PackageReference Include="Fake.DotNet.Cli" Version="6.0.0" />
<PackageReference Include="Fake.DotNet.NuGet" Version="6.0.0" />
<PackageReference Include="Fake.Tools.Git" Version="6.0.0" />
</ItemGroup>

Expand Down

0 comments on commit ecb2582

Please sign in to comment.