-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
77 lines (58 loc) · 1.7 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.IO.FileSystem
nuget Fake.DotNet.Cli
nuget Fake.Tools.Git
nuget Fake.Core.Target //"
#load "./.fake/build.fsx/intellisense.fsx"
open Fake.DotNet
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.Tools.Git
let buildDir = "./build/"
let cleanOpts (opt:DotNet.Options) = opt
Target.create "Clean" (fun _ ->
Shell.cleanDirs [buildDir]
DotNet.exec cleanOpts "clean" "TSPLIB.sln" |> ignore
)
Target.create "Test" (fun _ ->
let testOpts (opt:DotNet.TestOptions) =
{
opt with
Configuration=DotNet.BuildConfiguration.Debug
}
DotNet.test testOpts "TSPLIB.Tests"
)
Target.create "Release" (fun _ ->
let releaseOpts (opt:DotNet.BuildOptions) =
{
opt with
Configuration=DotNet.BuildConfiguration.Release;
OutputPath=Some(Path.combine __SOURCE_DIRECTORY__ buildDir);
}
DotNet.build releaseOpts "TSPLIB"
)
Target.create "Deploy-Nuget" (fun _ ->
let releaseVersion = Information.getLastTag().TrimStart([|'v'|])
System.Environment.SetEnvironmentVariable("TSPLIB_FS_VERSION", releaseVersion)
let packOpts (opt:DotNet.PackOptions) : DotNet.PackOptions =
{
opt with
Configuration=DotNet.BuildConfiguration.Release;
OutputPath=Some(Path.combine __SOURCE_DIRECTORY__ buildDir);
}
DotNet.pack packOpts "TSPLIB"
System.Environment.SetEnvironmentVariable("TSPLIB_FS_VERSION", "")
DotNet.exec cleanOpts "nuget" "push build/*.nupkg -s https://www.nuget.org -k ${NUGET_API_KEY}" |> ignore
)
Target.create "Help" (fun _ ->
Trace.trace "TSPLIB F# Build Script\nRun fake <script> -t [Target]"
)
"Clean"
==> "Test"
==> "Release"
==> "Help"
"Clean"
==> "Deploy-Nuget"
==> "Help"
Target.runOrDefault "Help"