-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.fsx
63 lines (47 loc) · 1.66 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
#r "nuget: Fun.Build, 1.1.14"
#r "nuget: Fake.DotNet.AssemblyInfoFile"
open Fun.Build
open Fake.IO
open Fake.DotNet
let version =
Changelog.GetLastVersion(__SOURCE_DIRECTORY__)
|> Option.defaultWith (fun () -> failwith "Version is not found")
pipeline "build" {
workingDir __SOURCE_DIRECTORY__
runBeforeEachStage (fun ctx ->
if ctx.GetStageLevel() = 0 then
printfn $"::group::{ctx.Name}")
runAfterEachStage (fun ctx ->
if ctx.GetStageLevel() = 0 then
printfn "::endgroup::")
stage "Check environment" {
run "dotnet tool restore"
run "dotnet restore"
}
stage "Check Formatting" { run "dotnet csharpier --check ." }
stage "Clean" {
run (fun _ ->
Shell.mkdir "bin"
Shell.cleanDir "bin")
run "dotnet clean"
}
stage "AssemblyInfo" {
run (fun _ ->
let fileName = "Clippit/Properties/AssemblyInfo.Generated.cs"
AssemblyInfoFile.createCSharp
fileName
[ AssemblyInfo.Title "Clippit"
AssemblyInfo.Product "Clippit"
AssemblyInfo.Description "Fresh PowerTools for OpenXml"
AssemblyInfo.Version version.Version
AssemblyInfo.FileVersion version.Version ])
}
stage "Build" { run "dotnet build Clippit.sln -c Release" }
stage "RunTests" { run "dotnet test Clippit.Tests/" }
stage "NuGet" {
run
$"dotnet pack Clippit/Clippit.csproj -o bin/ -p:PackageVersion={version.Version} -p:PackageReleaseNotes=\"{version.ReleaseNotes}\""
}
runIfOnlySpecified
}
tryPrintPipelineCommandHelp ()