Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/deploy-mcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy MCP Server

on:
workflow_dispatch:

concurrency:
group: deploy-mcp-server
cancel-in-progress: true

permissions:
contents: read

jobs:
deploy:
name: Deploy MCP Server to Cloudflare Workers
runs-on: ubuntu-latest
environment: prod-db
env:
LEADERBOARD_PATH: ${{ github.workspace }}/leaderboard

steps:
- name: 📥 Checkout Leaderboard
uses: actions/checkout@v6
with:
repository: ohcnetwork/leaderboard
path: ${{ env.LEADERBOARD_PATH }}
fetch-depth: 1

- name: 📦 Setup pnpm
uses: pnpm/action-setup@v5
with:
version: 10
run_install: false

- name: 📦 Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "pnpm"
cache-dependency-path: |
${{ env.LEADERBOARD_PATH }}/pnpm-lock.yaml

- name: 📦 Install Dependencies
working-directory: ${{ env.LEADERBOARD_PATH }}
run: pnpm install

- name: 🛠️ Build Packages
working-directory: ${{ env.LEADERBOARD_PATH }}
run: pnpm build:packages

- name: 🚀 Deploy MCP Server to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: ${{ env.LEADERBOARD_PATH }}/packages/mcp-server
command: deploy --d1 DB=${{ vars.CLOUDFLARE_D1_DATABASE_ID }}
19 changes: 19 additions & 0 deletions .github/workflows/scrape-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,22 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: r2 object put leaderboard-data/data.db --file data.db --content-type application/octet-stream

upload-db-d1:
name: Upload Database to Cloudflare D1
needs: scrape-data
runs-on: ubuntu-latest
environment: prod-db
steps:
- name: 📦 Download Database from GitHub Artifacts
uses: actions/download-artifact@v7
with:
name: data-${{ github.run_id }}.db
path: .

- name: 📦 Import Database to Cloudflare D1
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: d1 import ${{ vars.CLOUDFLARE_D1_DATABASE_NAME }} --file .leaderboard.db