-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (156 loc) · 5.78 KB
/
Copy pathdeploy.yml
File metadata and controls
167 lines (156 loc) · 5.78 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy
cancel-in-progress: false
jobs:
ci:
name: Lint, Build & Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
build: 'true'
- run: npx turbo lint
- run: npx turbo test
env:
DO_NOT_TRACK: '1'
- run: npm run test:container
deploy-observer-pages:
name: Deploy Observer Dashboard
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 20
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
build: 'true'
- uses: ./.github/actions/deploy-observer-dashboard
with:
branch: main
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
deploy-observer-router:
name: Deploy Observer Host Router
runs-on: ubuntu-latest
needs: deploy-observer-pages
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Deploy observer hostname router worker
run: npx wrangler deploy --config wrangler.observer-router.toml
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
deploy-pages:
name: Deploy to Cloudflare Pages
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 10
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- name: Inject PostHog API key into marketing site
env:
POSTHOG_PROJECT_KEY: ${{ vars.POSTHOG_PROJECT_KEY }}
run: |
node -e '
const fs = require("fs");
const file = "site/index.html";
const placeholder = "__RELAYCAST_POSTHOG_API_KEY__";
const key = process.env.POSTHOG_PROJECT_KEY || "";
const html = fs.readFileSync(file, "utf8");
if (!html.includes(placeholder)) {
console.error(`Placeholder ${placeholder} not found in ${file}`);
process.exit(1);
}
if (!key) {
console.warn("POSTHOG_PROJECT_KEY is unset — shipping site with telemetry disabled.");
}
fs.writeFileSync(file, html.split(placeholder).join(key));
'
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy site/ --project-name=relaycast
deploy-smithery:
name: Deploy MCP to Smithery
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 20
steps:
- name: Warm up MCP endpoint
run: |
sleep 15
for i in $(seq 1 10); do
RESP=$(curl -s -D /tmp/mcp-headers -X POST 'https://cast.agentrelay.com/mcp' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--max-time 10 \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"warmup","version":"1.0.0"}},"id":1}' 2>/dev/null)
if echo "$RESP" | grep -q '"tools"'; then
echo "Initialize OK after $i attempts"
break
fi
echo "Attempt $i: waiting for MCP..."
sleep 5
done
SESSION_ID=$(grep -i 'mcp-session-id' /tmp/mcp-headers | tr -d '\r' | awk '{print $2}')
if [ -n "$SESSION_ID" ]; then
curl -s -X POST 'https://cast.agentrelay.com/mcp' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SESSION_ID" \
--max-time 5 \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}' 2>/dev/null > /dev/null
TOOLS_RESP=$(curl -s -X POST 'https://cast.agentrelay.com/mcp' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $SESSION_ID" \
--max-time 15 \
-d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}' 2>/dev/null)
TOOL_COUNT=$(echo "$TOOLS_RESP" | grep -o '"name":"[^"]*"' | wc -l)
echo "tools/list warm-up returned $TOOL_COUNT name fields ($(echo "$TOOLS_RESP" | wc -c) bytes)"
else
echo "Warning: No session ID from initialize"
fi
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Publish to Smithery (with retry)
run: |
for attempt in 1 2 3 4 5; do
echo "=== Attempt $attempt of 5 ==="
OUTPUT=$(npx @smithery/cli@3 publish \
-u https://cast.agentrelay.com/mcp \
-n "relaycast/relay" \
-k "$SMITHERY_API_KEY" \
--config-schema packages/mcp/smithery-config-schema.json 2>&1) || true
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q "39 tools" && echo "$OUTPUT" | grep -q "1 prompt"; then
echo "Full capabilities detected (39 tools + 1 prompt)!"
break
fi
if [ "$attempt" -lt 5 ]; then
echo "Attempt $attempt: Incomplete scan, retrying in 30 seconds..."
sleep 30
else
echo "All 5 attempts completed without full detection."
fi
done
env:
SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}