ci(landing): auto-deploy to CF Pages on push to main
接好 leo 反饋的「Pages auto-deploy 沒接」坑。新增 .github/workflows/deploy-landing.yml: - push 到 main 且 landing/ 有變動 → build + 部署 - workflow_dispatch 也可手動觸發 - 用既有的 CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID secrets - 用 cloudflare/wrangler-action@v3 標準 action 下次 leo 推 landing 改動就會自動 deploy,不用 wrangler pages deploy 手動跑。
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
name: Deploy Landing
|
||||
|
||||
# 自動部署 landing/ (Next.js on Cloudflare Pages)
|
||||
# 觸發:push 到 main 且 landing/ 有變動,或手動
|
||||
# 為何獨立檔:landing 是 Pages 不是 Worker,跟 deploy.yml (掃 wrangler.toml) 邏輯不同
|
||||
# Secret 需要:CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID(既有)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'landing/**'
|
||||
- '.github/workflows/deploy-landing.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: deploy-landing-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Build + Deploy to CF Pages
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
deployments: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install
|
||||
working-directory: landing
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Build (Next.js)
|
||||
working-directory: landing
|
||||
run: pnpm next build
|
||||
|
||||
- name: Build for Pages
|
||||
working-directory: landing
|
||||
run: pnpm exec next-on-pages
|
||||
|
||||
- name: Deploy to Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy landing/.vercel/output/static --project-name arcrun-landing --branch main --commit-message "ci ${{ github.sha }}"
|
||||
Reference in New Issue
Block a user