- wrangler.toml: 新增 [env.test] 环境配置,移除硬编码自定义域名 - package.json: 新增 deploy:test 脚本 - .github/workflows/deploy.yml: 支持 test/main 双分支部署 - README/README_en: 更新部署流程和本地开发说明
39 lines
989 B
YAML
39 lines
989 B
YAML
name: Deploy to Cloudflare Workers
|
|
|
|
on:
|
|
push:
|
|
branches: [test, main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 'latest'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pnpm install
|
|
cd frontend && pnpm install
|
|
|
|
- name: Build frontend and deploy (test)
|
|
if: github.ref == 'refs/heads/test'
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
run: pnpm run deploy:test
|
|
|
|
- name: Build frontend and deploy (production)
|
|
if: github.ref == 'refs/heads/main'
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
run: pnpm run deploy
|