-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.fsx
96 lines (82 loc) · 2.6 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
// include Fake lib
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AppVeyor
// Project parameters
let buildDir = "./build/"
let packagingDir = "./.deploy/"
let baseVersion = "2017.2.0"
let version =
match buildServer with
| AppVeyor -> environVar "GitVersion_NuGetVersionV2"
| _ -> baseVersion + "-local"
let isPullRequest =
let prNumber =
match buildServer with
| AppVeyor -> environVarOrNone "APPVEYOR_PULL_REQUEST_NUMBER"
| _ -> None
match prNumber with
| Some(_) -> true
| None -> false
// NuGet
let projectName = "AsyncSuffix"
let nuspecFileName = projectName + ".nuspec"
let packageName = "Sizikov." + projectName
let galleryUri = "https://resharper-plugins.jetbrains.com"
let apiKey =
match buildServer with
| AppVeyor -> environVar "resharper_nuget_api_key"
| _ -> "Nothing here"
Target "Clean" (fun _ ->
CleanDirs [buildDir; packagingDir]
)
Target "BuildApp" (fun _ ->
!! "src/**/*.csproj"
|> MSBuild buildDir "Build" [ "Configuration", "Release" ]
|> Log "AppBuild-Output: "
)
Target "Default" (fun _ ->
DoNothing()
)
Target "CreatePackage" (fun _ ->
NuGet (fun p ->
{p with
OutputPath = packagingDir
WorkingDir = "."
Version = version
Publish = false })
nuspecFileName
)
Target "PublishPackage" (fun _ ->
let branch = Fake.Git.Information.getBranchName "."
if branch = "master" || Fake.AppVeyor.AppVeyorEnvironment.RepoTag then
if isLocalBuild then
trace "Package can only be published from Appveyor build"
else
match buildServer with
| AppVeyor ->
if isPullRequest then
trace "Skip publish from PR"
else
NuGetPublish (fun p ->
{ p with
AccessKey = apiKey
PublishUrl = galleryUri
NoPackageAnalysis = true
Publish = true
WorkingDir = packagingDir
OutputPath = packagingDir
Project = packageName
Version = version
})
| _ -> trace "Do not publish from local build"
else
trace "Package can only be published from master branch or a tag build"
DoNothing()
)
"Clean"
==> "BuildApp"
==> "CreatePackage"
==> "PublishPackage"
==> "Default"
RunTargetOrDefault "Default"