From 2d557a0382eb6501c2466f4b3ae5d85fefb92780 Mon Sep 17 00:00:00 2001 From: richblack Date: Thu, 16 Apr 2026 15:37:06 +0800 Subject: [PATCH] ci: add GitHub Actions deploy workflow for 3 Workers Auto-deploys on push to main when files in cypher-executor/, registry/, or credentials/ change. Manual dispatch deploys all three. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/deploy.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..cfdd8ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,67 @@ +name: Deploy Workers + +on: + push: + branches: [main] + paths: + - 'cypher-executor/**' + - 'registry/**' + - 'credentials/**' + +jobs: + deploy-cypher-executor: + name: Deploy cypher-executor + runs-on: ubuntu-latest + if: contains(toJson(github.event.commits), 'cypher-executor') || github.event_name == 'workflow_dispatch' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Deploy + working-directory: cypher-executor + run: npx wrangler deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + + deploy-registry: + name: Deploy registry + runs-on: ubuntu-latest + if: contains(toJson(github.event.commits), 'registry') || github.event_name == 'workflow_dispatch' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Deploy + working-directory: registry + run: npx wrangler deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + + deploy-credentials: + name: Deploy credentials + runs-on: ubuntu-latest + if: contains(toJson(github.event.commits), 'credentials') || github.event_name == 'workflow_dispatch' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Deploy + working-directory: credentials + run: npx wrangler deploy + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + + # 手動觸發:部署全部三個 Worker + deploy-all: + name: Deploy all (manual) + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + needs: [deploy-cypher-executor, deploy-registry, deploy-credentials] + steps: + - run: echo "All workers deployed"