From 0f2a00e0d5e669020688ab9f9a9b9a704c0c2944 Mon Sep 17 00:00:00 2001 From: richblack Date: Sat, 16 May 2026 09:29:57 +0800 Subject: [PATCH] ci(landing): auto-deploy to CF Pages on push to main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 接好 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 手動跑。 --- .github/workflows/deploy-landing.yml | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/deploy-landing.yml diff --git a/.github/workflows/deploy-landing.yml b/.github/workflows/deploy-landing.yml new file mode 100644 index 0000000..a3c34a1 --- /dev/null +++ b/.github/workflows/deploy-landing.yml @@ -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 }}"