-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.fsx
74 lines (60 loc) · 1.76 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
#r @"packages/build/FAKE/tools/FakeLib.dll"
open Fake
open Fake.Git
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.UserInputHelper
open System
let release = LoadReleaseNotes "RELEASE_NOTES.md"
let srcGlob = "*.csproj"
Target "Clean" (fun _ ->
[ "obj" ;"dist"]
|> CleanDirs
)
Target "DotnetRestore" (fun _ ->
!! srcGlob
|> Seq.iter (fun proj ->
DotNetCli.Restore (fun c ->
{ c with
Project = proj
})
))
Target "DotnetPack" (fun _ ->
!! srcGlob
|> Seq.iter (fun proj ->
DotNetCli.Pack (fun c ->
{ c with
Project = proj
Configuration = "Release"
OutputPath = IO.Directory.GetCurrentDirectory() @@ "dist"
AdditionalArgs =
[
sprintf "/p:PackageVersion=%s" release.NugetVersion
sprintf "/p:PackageReleaseNotes=\"%s\"" (String.Join("\n",release.Notes))
]
})
)
)
Target "Publish" (fun _ ->
Paket.Push(fun c ->
{ c with
PublishUrl = "https://www.nuget.org"
WorkingDir = "dist"
}
)
)
Target "Release" (fun _ ->
if Git.Information.getBranchName "" <> "master" then failwith "Not on master"
let releaseNotesGitCommitFormat = ("",release.Notes |> Seq.map(sprintf "* %s\n")) |> String.Join
StageAll ""
Git.Commit.Commit "" (sprintf "Bump version to %s \n%s" release.NugetVersion releaseNotesGitCommitFormat)
Branches.push ""
Branches.tag "" release.NugetVersion
Branches.pushTag "" "origin" release.NugetVersion
)
"Clean"
==> "DotnetRestore"
==> "DotnetPack"
==> "Publish"
==> "Release"
RunTargetOrDefault "DotnetPack"