-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.fsx
54 lines (40 loc) · 1.33 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
#r "nuget: Fun.Build, 0.3.8"
#r "nuget: Fake.IO.FileSystem, 5.23.1"
#r "nuget: FsToolkit.ErrorHandling, 4.6.0"
open Fun.Build
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open FsToolkit.ErrorHandling
open System.Text.RegularExpressions
pipeline "Release" {
stage "Clean artifacts" {
paralle
run(fun _ ->
[
"src/react/bin/"
"src/react/obj/"
]
|> Shell.cleanDirs
)
}
stage "Package: Fable.Template.Elmish.React" {
workingDir "src/react"
whenAll {
envVar "NUGET_KEY"
}
run (fun ctx ->
asyncResult {
let! dotnetPackOutput = ctx.RunCommandCaptureOutput "dotnet pack"
let m = Regex.Match(dotnetPackOutput, ".*'(?<nupkg_path>.*\.(?<version>.*\..*\..*)\.nupkg)'")
if not m.Success then
failwithf "Couldn't find NuGet package in output: %s" dotnetPackOutput
let nupkgPath = m.Groups.["nupkg_path"].Value
let nugetKey = ctx.GetEnvVar "NUGET_KEY"
do! ctx.RunSensitiveCommand $"dotnet nuget push {nupkgPath} -k {nugetKey} -s https://api.nuget.org/v3/index.json"
}
)
}
runIfOnlySpecified false
}
tryPrintPipelineCommandHelp()