Skip to content

Commit 2213e53

Browse files
committed
ci: add Cloudflare Pages deploy workflow for web/ sites
Matrix job builds and deploys each of the four sites (landing, blog, guides, api) via cloudflare/wrangler-action on push to develop (production deploy) and on PRs (preview deploy with a unique URL). Path filter limits runs to actual web/ changes. Concurrency group cancels in-progress deploys when newer commits land. Requires two repo secrets: - CLOUDFLARE_API_TOKEN (Pages:Edit on this account) - CLOUDFLARE_ACCOUNT_ID
1 parent aec7664 commit 2213e53

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/web-deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy static sites
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
paths:
7+
- 'web/**'
8+
- '.github/workflows/web-deploy.yml'
9+
pull_request:
10+
branches: [develop]
11+
paths:
12+
- 'web/**'
13+
- '.github/workflows/web-deploy.yml'
14+
15+
concurrency:
16+
group: web-deploy-${{ matrix.site }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
deploy:
21+
name: Deploy ${{ matrix.site }}
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
deployments: write
26+
pull-requests: write
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
site: [landing, blog, guides, api]
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Set up pnpm
37+
uses: pnpm/action-setup@v4
38+
with:
39+
version: 10.23.0
40+
41+
- name: Set up Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: 22
45+
cache: pnpm
46+
cache-dependency-path: web/pnpm-lock.yaml
47+
48+
- name: Install dependencies
49+
working-directory: web
50+
run: pnpm install --frozen-lockfile
51+
52+
- name: Build ${{ matrix.site }}
53+
working-directory: web
54+
run: pnpm --filter @wheels-dev/site-${{ matrix.site }} build
55+
56+
- name: Deploy to Cloudflare Pages
57+
uses: cloudflare/wrangler-action@v3
58+
env:
59+
# Untrusted inputs — pass via env to prevent command injection
60+
DEPLOY_BRANCH: ${{ github.head_ref || github.ref_name }}
61+
with:
62+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
63+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
64+
command: pages deploy web/sites/${{ matrix.site }}/dist --project-name=wheels-${{ matrix.site }} --branch="$DEPLOY_BRANCH" --commit-hash="$GITHUB_SHA"

0 commit comments

Comments
 (0)