Skip to content

Commit

Permalink
feat(ci): implement ability to push to GitHub packages
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Nov 7, 2024
1 parent f37e0df commit 1e92f99
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -447,18 +447,35 @@ let sourceLinkTest _ =
!!distGlob
|> Seq.iter (fun nupkg -> dotnet.sourcelink id $"test %s{nupkg}")

type PushSource =
| NuGet
| GitHub

let publishToNuget _ =
allPublishChecks ()

Paket.push (fun c -> {
let source =
#if NuGet
NuGet
#else
GitHub
#endif

distGlob
|> DotNet.nugetPush (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
Common = { c.Common with WorkingDirectory = "dist" }
PushParams = {
c.PushParams with
Source =
match source with
| NuGet -> None
| GitHub -> Some "github"
ApiKey =
match source with
| NuGet -> nugetToken
| GitHub -> githubToken
}
})

let gitRelease _ =
Expand Down

0 comments on commit 1e92f99

Please sign in to comment.