mirror of
https://github.com/jnMetaCode/superpowers-zh.git
synced 2026-09-02 22:54:06 +08:00
fix(ci): 部署前确保 Cloudflare Pages 项目存在
首次部署因 "Project not found" 失败——wrangler pages deploy 不会自动 创建项目。新增一步 wrangler pages project create(幂等,已存在则跳过), 用已配置的 CLOUDFLARE_API_TOKEN(含 Pages:Edit 权限)自动建项目, 使 CI 全自动完成"建项目 + 部署",无需手动在面板创建。
This commit is contained in:
10
.github/workflows/deploy-site.yml
vendored
10
.github/workflows/deploy-site.yml
vendored
@@ -25,6 +25,16 @@ jobs:
|
||||
node-version: 20
|
||||
- name: Build site
|
||||
run: node site/build.mjs
|
||||
# 首次部署前确保 Pages 项目存在(wrangler pages deploy 不会自动创建)。
|
||||
# 幂等:项目已存在时创建命令报错,由 || 兜住继续。token 需 Pages:Edit 权限。
|
||||
- name: Ensure Pages project exists
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
run: |
|
||||
npx --yes wrangler@3 pages project create superpowers-zh-site \
|
||||
--production-branch main \
|
||||
|| echo "项目已存在或创建跳过,继续部署"
|
||||
- name: Deploy to Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user