ci: fix workflow_dispatch trigger + simplify job structure

This commit is contained in:
2026-04-16 15:41:14 +08:00
parent 9b648fc5fb
commit fcc7fdcf59
+10 -12
View File
@@ -7,17 +7,20 @@ on:
- 'cypher-executor/**'
- 'registry/**'
- 'credentials/**'
workflow_dispatch: # 允許手動觸發,部署全部三個
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: Install deps
working-directory: cypher-executor
run: npm install --legacy-peer-deps
- name: Deploy
working-directory: cypher-executor
run: npx wrangler deploy
@@ -28,12 +31,14 @@ jobs:
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: Install deps
working-directory: registry
run: npm install --legacy-peer-deps
- name: Deploy
working-directory: registry
run: npx wrangler deploy
@@ -44,24 +49,17 @@ jobs:
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: Install deps
working-directory: credentials
run: npm install --legacy-peer-deps
- 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"