name: Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate:
name: 🔍 Validate
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 🔍 Validate
run: npm run validate
release:
name: 🚀 Release
needs: [validate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Validate
run: npm run validate
- name: Create deployment config
if: github.ref == 'refs/heads/main'
run: |
cat > wrangler.deploy.jsonc << 'EOF'
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "schwab-mcp",
"main": "src/index.ts",
"compatibility_date": "2025-04-17",
"compatibility_flags": ["nodejs_compat"],
"migrations": [
{
"new_sqlite_classes": ["MyMCP"],
"tag": "v1"
}
],
"durable_objects": {
"bindings": [
{
"class_name": "MyMCP",
"name": "MCP_OBJECT"
}
]
},
"kv_namespaces": [
{
"binding": "OAUTH_KV",
"id": "${{ secrets.OAUTH_KV_ID }}"
}
],
"observability": {
"enabled": true
},
"dev": {
"port": 8788,
"local_protocol": "https",
"upstream_protocol": "https"
}
}
EOF
- name: Deploy to Cloudflare Workers
if: github.ref == 'refs/heads/main'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --config wrangler.deploy.jsonc