-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
58 lines (43 loc) · 1.22 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#r "nuget: Fun.Build, 0.3.6"
open Fun.Build
open System.IO
open System
let nugetPushCommand (apiKey: string) : System.FormattableString =
$"dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json --skip-duplicate -k {apiKey}"
pipeline "Build" {
description "Build Inertial.Lib"
stage "Restore" {
run "dotnet tool restore"
run "dotnet restore"
}
stage "Build" { run "dotnet build" }
//stage "Check formatting" { run "dotnet fantomas --recurse --check ./" }
//stage "Test" { run "dotnet test" }
runIfOnlySpecified false
}
pipeline "Publish" {
description "Publish Inertial.Lib to NuGet"
whenAll {
branch "main"
whenAny {
envVar "NUGET_API_KEY"
cmdArg "NUGET_API_KEY"
}
}
stage "Pack" { run "dotnet pack -c Release ./src/Inertial.Lib -o ." }
stage "Publish" {
run (fun ctx ->
let key = ctx.GetCmdArgOrEnvVar "NUGET_API_KEY"
runSensitive (nugetPushCommand key))
}
post [
stage "Post publish" {
whenNot { envVar "GITHUB_ACTION" }
run (fun _ ->
let nugetPackageFiles =
Directory.EnumerateFiles(Environment.CurrentDirectory, "*.nupkg")
nugetPackageFiles |> Seq.iter File.Delete)
}
]
runIfOnlySpecified true
}