-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.fsx
97 lines (75 loc) · 2.57 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#r "paket:
nuget Fake.Core.Target
nuget Fake.IO.FileSystem
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket
nuget Fake.BuildServer.GitHubActions
"
#load "./.fake/build.fsx/intellisense.fsx"
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.DotNet
let version = Environment.environVarOrDefault "VERSION" "0.0.1"
let nugetKey = Environment.environVarOrDefault "NUGET_API_KEY" ""
let v0 = "src/AuthZedClient.V0/AuthZedClient.V0.csproj"
let v1 = "src/AuthZedClient.V1/AuthZedClient.V1.csproj"
let sln = "authzed-dotnet.sln"
let packageDir = "publish/"
Target.create "Clean" ( fun _ ->
Trace.log " --- clean stuff ---"
DotNet.exec id "clean" $"{sln}" |> ignore
Shell.cleanDir packageDir
)
Target.create "Restore" (fun _ ->
Trace.log "--- restoring paket ---"
Paket.restore (fun opt -> { opt with ToolType = ToolType.CreateLocalTool () } )
)
Target.create "BuildV1" (fun _ ->
Trace.log "--- build ---"
DotNet.build (fun opt -> { opt with
Configuration = DotNet.BuildConfiguration.Release
}) v1
)
Target.create "BuildV0" (fun _ ->
Trace.log "--- build ---"
DotNet.build (fun opt -> { opt with
Configuration = DotNet.BuildConfiguration.Release
}) v0
)
let makePackOptions template (opt : Paket.PaketPackParams) =
{ opt with
ToolType = ToolType.CreateLocalTool ()
TemplateFile = template
Version = version
OutputPath = packageDir
LockDependencies = true
}
Target.create "PackV0" (fun _ ->
Trace.log "--- publishing V0 ---"
Paket.pack (makePackOptions "src/AuthZedClient.V0/paket.template")
)
Target.create "PackV1" (fun _ ->
Trace.log "--- publishing V1 ---"
Paket.pack (makePackOptions "src/AuthZedClient.V1/paket.template")
)
let makePushOptions (opt: Paket.PaketPushParams) =
{ opt with
ToolType = ToolType.CreateLocalTool ()
ApiKey = nugetKey
WorkingDir = packageDir
}
Target.create "Release" (fun _ ->
Paket.push makePushOptions
)
Target.create "Pack" ignore
Target.create "Build" ignore
"Restore" ==> "BuildV0" ==> "PackV0"
"Restore" ==> "BuildV1" ==> "PackV1"
"BuildV0" ==> "Build"
"BuildV1" ==> "Build"
"PackV0" ==> "Pack"
"PackV1" ==> "Pack"
"Clean" ==> "Pack" ==> "Release"
Target.runOrDefault "BuildV1"