-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
81 lines (68 loc) · 2.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#r "paket:
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket
nuget Fake.IO.FileSystem
nuget Fake.Tools.Git
//"
#load ".fake/build.fsx/intellisense.fsx"
open System.Text.RegularExpressions
open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators
open Fake.Tools.Git
Target.initEnvironment ()
Target.create "Clean" (fun _ ->
!! "src/**/bin"
++ "src/**/obj"
|> Shell.cleanDirs
)
Target.create "PackageInstall" (fun _ ->
DotNet.exec id "paket" "install"
|> ignore)
Target.create "Build" (fun _ ->
!! "src/**/*.*proj"
|> Seq.iter (DotNet.build id)
)
Target.create "Pack" (fun _ ->
//let tags = Information.getLastTag()
let tag = CommandHelper.runSimpleGitCommand __SOURCE_DIRECTORY__ "describe --contains"
if not(Regex.IsMatch(tag, @"^v[0-9]+\.[0-9]+\.[0-9]+(-[^^~]+)?$")) then
failwithf "invalid versioning tag: %s" tag
Paket.pack
(fun p ->
{ p with
ToolType = ToolType.CreateLocalTool()
BuildConfig = "Release"
Version = tag.Substring(1)
TemplateFile = "src/BitThicket.AspNetCore/paket.template" }))
Target.create "Push" (fun _ ->
Paket.push
(fun p ->
match Environment.environVarOrNone "NUGET_FEED_URL" with
| None -> failwith "no feed url provided"
| Some feedUrl ->
match Environment.environVarOrNone "NUGET_FEED_KEY" with
| None ->
Trace.log "No API key provided."
{ p with
ToolType = ToolType.CreateLocalTool()
WorkingDir = "./temp"
PublishUrl = feedUrl}
| Some key ->
{ p with
ToolType = ToolType.CreateLocalTool()
WorkingDir = "./temp"
PublishUrl = feedUrl
ApiKey = key}))
"PackageInstall"
==> "Build"
Target.create "All" ignore
"Clean"
==> "Build"
==> "Pack"
==> "All"
Target.runOrDefault "All"