-
Notifications
You must be signed in to change notification settings - Fork 5
/
demo-cmd.fsx
67 lines (59 loc) · 1.7 KB
/
demo-cmd.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
#r "nuget: Fun.Result, 0.2.1"
#r "nuget: Spectre.Console, 0.46.0"
#r "Fun.Build/bin/Debug/netstandard2.0/Fun.Build.dll"
open Fun.Build
module Apps =
let app1 = "app1"
let app2 = "app2"
let app3 = "app3"
let all = [ app1; app2; app3 ]
let args = {|
app = fun apps -> CmdArg.Create(shortName = "-a", longName = "--app", values = apps, description = "specify the app you want to dev")
path = CmdArg.Create("-f", "--file", "publish directory for the app")
watch = CmdArg.Create(shortName = "-w", description = "if is in watch mode")
|}
pipeline "demo" {
description "simple demo"
whenBranch "master"
whenCmdArg (args.app Apps.all)
whenEnvVar "ENV1" "" "Test env1"
whenEnvVar "ENV2"
stage "build" {
whenEnvVar "ENV3"
whenEnvVar "ENV4"
stage "tailwindcss" {
whenCmdArg args.watch
echo "tailwindcss building"
}
stage Apps.app1 {
whenCmdArg (args.app [ Apps.app1 ])
echo $"run {Apps.app1}"
}
stage Apps.app2 {
whenAny {
envVar "TEST1"
cmdArg (args.app [ Apps.app2 ])
}
echo $"run {Apps.app2}"
}
}
stage "publish" {
whenBranch "master"
whenCmdArg args.path
whenCmdArg "--foo" "" "sd" true
whenCmd {
name "-s"
longName "--send"
optional
}
whenEnv {
name "TEST2"
acceptValues [ "foo1"; "foo2" ]
description "This is for demo"
optional
}
run (fun ctx -> printfn "%A" (ctx.TryGetCmdArg(args.path)))
}
runIfOnlySpecified
}
tryPrintPipelineCommandHelp ()