Skip to content

Commit 6cb6c03

Browse files
authored
fix: deploy mcp on merge (#46)
* fix: stop using nonexistent option * fix: update package name * chore: add deploy to pull request workflow * fix: indentation * fix: use run to get access to secrets * inherit secrets * chore: use copy-paste approach instead of separated workflow * fix: use builtin wrangler action * fix: use dedicated worker token * fix: adjust secrets * fix: add secret as repo secret * chore: remove worker deploy from pr workflow
1 parent 639c858 commit 6cb6c03

File tree

6 files changed

+84
-59
lines changed

6 files changed

+84
-59
lines changed

.github/workflows/deploy-mcp-on-merge.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,35 @@ on:
66
- master # Trigger only on pushes to the master branch
77

88
jobs:
9-
deploy:
10-
name: Deploy MCP Server
11-
uses: ./.github/workflows/deploy-mcp-server.yml
12-
# Pass secrets explicitly to the called workflow's 'secrets' input
13-
secrets:
14-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
15-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
9+
deploy-mcp-worker:
10+
name: Deploy Worker (mcp-server)
11+
runs-on: ubuntu-latest
12+
environment: production
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
# We need Node.js to generate rules and run wrangler/npm
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version-file: '.nvmrc' # Assuming .nvmrc is in the root
22+
cache: 'npm'
23+
cache-dependency-path: '**/package-lock.json' # Cache npm deps for root and worker
24+
25+
- name: Install root dependencies
26+
run: npm ci
27+
28+
- name: Generate preparedRules.json
29+
run: npm run generate-rules # Assuming direct execution works
30+
31+
- name: Install worker dependencies
32+
run: cd mcp-server && npm ci
33+
34+
- name: Deploy Worker (mcp-server)
35+
uses: cloudflare/wrangler-action@v3
36+
with:
37+
apiToken: ${{ secrets.CLOUDFLARE_WORKER_TOKEN }}
38+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
39+
workingDirectory: "./mcp-server"
40+
command: deploy

.github/workflows/deploy-mcp-server.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/master.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,34 @@ jobs:
8686
command: pages deploy dist --project-name='ai-rules-builder' # Use the command input
8787
gitHubToken: ${{ secrets.GITHUB_TOKEN }} # Optional: Adds commit details to deployments
8888

89-
deploy-worker:
90-
name: Deploy Worker
91-
needs: deploy # Run after successful pages deployment
89+
deploy-mcp-worker:
90+
name: Deploy Worker (mcp-server)
9291
runs-on: ubuntu-latest
93-
permissions:
94-
contents: read # Needed to checkout the repository
9592
steps:
9693
- name: Checkout repository
9794
uses: actions/checkout@v4
9895

99-
- name: Call Deploy Worker Workflow
100-
uses: ./.github/workflows/deploy-mcp-server.yml
96+
# We need Node.js to generate rules and run wrangler/npm
97+
- name: Set up Node.js
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version-file: '.nvmrc' # Assuming .nvmrc is in the root
101+
cache: 'npm'
102+
cache-dependency-path: '**/package-lock.json' # Cache npm deps for root and worker
103+
104+
- name: Install root dependencies
105+
run: npm ci
106+
107+
- name: Generate preparedRules.json
108+
run: npm run generate-rules # Assuming direct execution works
109+
110+
- name: Install worker dependencies
111+
run: cd mcp-server && npm ci
112+
113+
- name: Deploy Worker (mcp-server)
114+
uses: cloudflare/wrangler-action@v3
101115
with:
102-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
103-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
116+
apiToken: ${{ secrets.CLOUDFLARE_WORKER_TOKEN }}
117+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
118+
workingDirectory: "./mcp-server"
119+
command: deploy

.github/workflows/pull-request.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,27 @@ jobs:
163163
`- E2E Tests: ${e2eStatus}\n\n` +
164164
`Please check the workflow logs for details.`
165165
});
166+
167+
deploy-mcp-worker:
168+
name: Deploy Worker (mcp-server)
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Checkout repository
172+
uses: actions/checkout@v4
173+
174+
# We need Node.js to generate rules and run wrangler/npm
175+
- name: Set up Node.js
176+
uses: actions/setup-node@v4
177+
with:
178+
node-version-file: '.nvmrc' # Assuming .nvmrc is in the root
179+
cache: 'npm'
180+
cache-dependency-path: '**/package-lock.json' # Cache npm deps for root and worker
181+
182+
- name: Install root dependencies
183+
run: npm ci
184+
185+
- name: Generate preparedRules.json
186+
run: npm run generate-rules # Assuming direct execution works
187+
188+
- name: Install worker dependencies
189+
run: cd mcp-server && npm ci

mcp-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# remote-mcp-server-authless
1+
# 10x Rules MCP Server
22

33
## 1. Project Description
44

mcp-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "remote-mcp-server-authless",
3-
"version": "0.0.0",
2+
"name": "10x-rules-mcp-server",
3+
"version": "0.0.1",
44
"private": true,
55
"scripts": {
66
"deploy": "wrangler deploy",

0 commit comments

Comments
 (0)