-
Notifications
You must be signed in to change notification settings - Fork 35
/
Build.fs
42 lines (33 loc) · 1.16 KB
/
Build.fs
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
open System.IO
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.TargetOperators
open BuildHelpers
open BuildTools
initializeContext()
let clean proj = [ proj </> "bin"; proj </> "obj" ] |> Shell.cleanDirs
let createNuget proj =
clean proj
Tools.dotnet "restore --no-cache" proj
Tools.dotnet "pack -c Release" proj
let publishNuget proj =
createNuget proj
let nugetKey =
match Environment.environVarOrNone "NUGET_KEY" with
| Some nugetKey -> nugetKey
| None -> failwith "The Nuget API key must be set in a NUGET_KEY environmental variable"
let nupkg =
Directory.GetFiles(proj </> "bin" </> "Release")
|> Seq.head
|> Path.GetFullPath
Tools.dotnet (sprintf "nuget push %s -s nuget.org -k %s" nupkg nugetKey) proj
Target.create "Pack" (fun _ -> "src" </> "Dapper.FSharp" |> createNuget)
Target.create "Publish" (fun _ -> "src" </> "Dapper.FSharp" |> publishNuget)
Target.create "Test" (fun _ -> Tools.dotnet "test" ("tests" </> "Dapper.FSharp.Tests"))
let dependencies = [
"Test" ==> "Pack"
"Test" ==> "Publish"
]
[<EntryPoint>]
let main args = runOrDefault "Test" args