-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
77 lines (64 loc) · 1.58 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
#r "paket:
nuget Fake.DotNet.Cli
nuget Fake.IO.FileSystem
nuget Fake.Core.Target //"
#load ".fake/build.fsx/intellisense.fsx"
open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators
let artifactsPath = Path.getFullName ".artifacts"
let publishPath = artifactsPath @@ "publish"
let appProjects = !! "src/app/**/*.*proj"
let testProjects = !! "src/test/**/*.*proj"
Target.create "Clean" (fun _ ->
!! "src/**/bin"
++ "src/**/obj"
++ artifactsPath
|> Shell.cleanDirs
Directory.ensure(artifactsPath)
)
Target.create "Build" (fun _ ->
appProjects
|> Seq.iter (DotNet.build id)
)
Target.create "Test" (fun _ ->
testProjects
|> Seq.iter (DotNet.test id)
)
Target.create "Pack" (fun _ ->
Directory.ensure publishPath
appProjects
|> Seq.iter (DotNet.pack (fun opt ->
{ opt with
OutputPath = Some publishPath
MSBuildParams =
{ opt.MSBuildParams with
DisableInternalBinLog = true
}
}
))
)
Target.create "Publish" (fun _ ->
!! (publishPath @@ "*.nupkg")
|> Seq.iter (DotNet.nugetPush (fun opt ->
opt.WithPushParams(
{ opt.PushParams with
ApiKey = Some (Environment.environVarOrFail "NUGET_KRAFTEQ_API_KEY")
Source = Some "https://api.nuget.org/v3/index.json"
})
))
)
Target.create "All" ignore
"Clean"
==> "Build"
==> "All"
"Clean"
==> "Test"
==> "All"
"Clean"
==> "Pack"
==> "Publish"
Target.runOrDefault "All"