-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.fsx
72 lines (64 loc) · 2.31 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
#r "nuget: Fun.Build, 1.0.4"
#r "nuget: Fake.IO.FileSystem, 6.0.0"
open System
open System.IO
open Fake.IO
open Fake.IO.FileSystemOperators
open Fun.Build
let solutionFile = "Giraffe.OpenApi.sln"
let apiKey = Environment.GetEnvironmentVariable "GIRAFFE_OPENAPI_NUGET_KEY"
let packageOutput = __SOURCE_DIRECTORY__ </> "artifacts" </> "package" </> "release"
pipeline "Build" {
workingDir __SOURCE_DIRECTORY__
stage "clean" {
run (fun _ ->
async {
let deleteIfExists folder =
if Directory.Exists folder then
Directory.Delete(folder, true)
deleteIfExists packageOutput
deleteIfExists (__SOURCE_DIRECTORY__ </> "output")
deleteIfExists (__SOURCE_DIRECTORY__ </> "docs" </> ".tool" </> "dist")
return 0
}
)
}
stage "lint" {
run "dotnet tool restore"
run "dotnet fantomas . --check"
}
stage "restore" { run "dotnet restore -tl" }
stage "build" { run "dotnet build --no-restore -c Release ./Giraffe.OpenApi.sln -tl" }
stage "test" { run "dotnet test --no-restore --no-build -c Release -tl" }
stage "pack" { run "dotnet pack ./src/Giraffe.OpenApi/Giraffe.OpenApi.fsproj -c Release -tl" }
// stage "docs" {
// stage "client" {
// workingDir "tool/client"
// run "bun i --frozen-lockfile"
// run "bunx --bun vite build"
// }
// run (fun _ -> Shell.copyRecursive "./tool/client/dist" "./docs" true |> ignore)
// run "dotnet fsdocs build --noapidocs"
// }
stage "push" {
whenCmdArg "--push"
workingDir packageOutput
run
$"dotnet nuget push Giraffe.OpenApi.*.nupkg --source https://api.nuget.org/v3/index.json --api-key {apiKey} --skip-duplicate"
}
runIfOnlySpecified false
}
pipeline "Analyze" {
workingDir __SOURCE_DIRECTORY__
stage "Report" { run $"dotnet msbuild /t:AnalyzeSolution %s{solutionFile}" }
runIfOnlySpecified true
}
pipeline "Publish" {
workingDir __SOURCE_DIRECTORY__
stage "publish" {
run
"dotnet publish --nologo -c Release --ucr -p:PublishReadyToRun=true ./src/Giraffe.OpenApi/Giraffe.OpenApi.fsproj"
}
runIfOnlySpecified true
}
tryPrintPipelineCommandHelp ()