ci(website): deploy to cloudflare pages

This commit is contained in:
Willie
2026-06-11 11:06:10 +08:00
parent d01a5b2cb4
commit 68639be975
+52
View File
@@ -0,0 +1,52 @@
name: Website Pages
on:
push:
branches: [main]
paths:
- "website/**"
- ".github/workflows/website-pages.yml"
pull_request:
branches: [main]
paths:
- "website/**"
- ".github/workflows/website-pages.yml"
workflow_dispatch:
permissions:
contents: read
deployments: write
env:
CLOUDFLARE_PROJECT_NAME: skillshare
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
- name: Build website
working-directory: website
run: npm run build
- name: Deploy to Cloudflare Pages
if: github.event_name != 'pull_request'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy website/build --project-name=${{ env.CLOUDFLARE_PROJECT_NAME }} --branch=${{ github.ref_name }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}