-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui-build-and-serve.yaml
More file actions
85 lines (78 loc) · 2.3 KB
/
ui-build-and-serve.yaml
File metadata and controls
85 lines (78 loc) · 2.3 KB
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
# UI Build & Serve Pipeline
#
# Demonstrates using step.build_ui to build a React/Vite UI from source,
# then serving the built assets via static.fileserver.
#
# This enables config-driven UI builds without CLI commands — the workflow
# engine handles npm install, npm run build, and artifact serving automatically.
#
# Usage:
# go run ./cmd/server -config example/ui-build-and-serve.yaml
# # Then POST to /api/build-ui to trigger the build
# curl -X POST http://localhost:9090/api/build-ui
# # After build completes, the UI is served at http://localhost:9090/
name: ui-build-and-serve
version: "1.0"
description: >
Pipeline-driven UI build and static file serving. Builds the React/Vite
UI from source and serves the resulting artifacts via static.fileserver,
all without manual CLI commands.
requires:
plugins:
- name: api
- name: pipeline-steps
- name: workflow-plugin-http
modules:
# HTTP server to serve the built UI and accept build triggers
- name: ui-server
type: http.server
config:
address: ":9090"
# Router for the UI server
- name: ui-router
type: http.router
dependsOn:
- ui-server
# Command handler for build operations
- name: build-commands
type: api.command
dependsOn:
- ui-router
config:
service_name: build-commands
# Static file server for the built UI assets
- name: ui-static
type: static.fileserver
dependsOn:
- ui-router
config:
root: "./ui_built"
prefix: "/"
spaFallback: true
cacheMaxAge: 3600
workflows:
http:
server: ui-server
router: ui-router
routes:
# Build trigger route — POST to this to build the UI from source
- path: /api/build-ui
method: POST
handler: build-commands
pipeline:
steps:
- name: build-ui-assets
type: step.build_ui
config:
source_dir: "../ui"
output_dir: "./ui_built"
install_cmd: "npm install --silent"
build_cmd: "npm run build"
timeout: "5m"
- name: respond-success
type: step.json_response
config:
status: 200
body:
status: "success"
message: "UI build complete"