-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
79 lines (58 loc) · 1.48 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#r "nuget: Fun.Result, 2.0.9"
#r "nuget: Fun.Build, 1.0.9"
open System.IO
open Fun.Build
let version = "2.0.0"
let build name = stage $"Build {name}" { run $"dotnet build src/{name}" }
let test shouldRebuild = stage "Test" {
run(fun ctx ->
let arg = if shouldRebuild then "--no-build" else ""
ctx.RunCommand $"dotnet test {arg}")
}
let pack name = stage $"Pack {name}" {
run $"dotnet pack src/{name} -p:Version={version} -o dist"
}
let pushNugets = stage $"Push to NuGet" {
run(fun ctx -> async {
let nugetApiKey = ctx.GetEnvVar "NUGET_DEPLOY_KEY"
let nugets = Directory.GetFiles(__SOURCE_DIRECTORY__ + "/dist", "*.nupkg")
for nuget in nugets do
printfn "Pushing %s" nuget
let! res =
ctx.RunSensitiveCommand
$"dotnet nuget push {nuget} --skip-duplicate -s https://api.nuget.org/v3/index.json -k {nugetApiKey}"
match res with
| Ok _ -> return ()
| Error err -> failwith err
})
}
pipeline "nuget" {
build "Hox"
build "Hox.Feliz"
test false
pack "Hox"
pack "Hox.Feliz"
pushNugets
runIfOnlySpecified true
}
pipeline "build" {
build "Hox"
build "Hox.Feliz"
test false
runIfOnlySpecified false
}
pipeline "nuget:local" {
build "Hox"
build "Hox.Feliz"
test false
pack "Hox"
pack "Hox.Feliz"
runIfOnlySpecified true
}
pipeline "build:docs" {
stage "Build docs" {
run $"dotnet run --project src/Hox.Docs -- --is-gh-pages"
}
runIfOnlySpecified true
}
tryPrintPipelineCommandHelp()