Cloudflare Pages Deployment Guide
Flügel Physics is built with VitePress, compiling into a lightning-fast, zero-runtime static documentation site. It can be hosted on Cloudflare Pages (Free Tier) with global edge distribution and automated CI/CD.
Method 1: Automated Git-Connected Deployment (Recommended)
- Push your repository to GitHub or GitLab.
- Log in to the Cloudflare Dashboard and navigate to Workers & Pages
Create Application Pages Connect to Git. - Select the
Flugel-Physicsrepository. - Set the build configurations:
- Framework Preset:
VitePress - Build Command:
npm run docs:build - Build Output Directory:
.vitepress/dist - Node.js Version:
20(Set environment variableNODE_VERSION = 20if necessary)
- Framework Preset:
- Click Save and Deploy. Cloudflare Pages will automatically trigger a production build on every
git pushtomain.
Method 2: GitHub Actions Workflow with Wrangler
If you prefer deploying via GitHub Actions using the Cloudflare Wrangler CLI, use the included workflow in .github/workflows/pages-deploy.yml:
yaml
name: Deploy to Cloudflare Pages
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Build Static Site
run: npm run docs:build
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy .vitepress/dist --project-name=flugel-physicsSetting GitHub Secrets
In your GitHub repository
CLOUDFLARE_API_TOKEN: Cloudflare API Token with Cloudflare Pages: Edit permissions.CLOUDFLARE_ACCOUNT_ID: Your Cloudflare Account ID found in the dashboard URL or Workers/Pages sidebar.
Method 3: Direct CLI Deployment with Wrangler
You can also deploy directly from your local terminal:
bash
# Build the production assets
npm run docs:build
# Deploy with Wrangler (will prompt for Cloudflare authentication on first run)
npx wrangler pages deploy .vitepress/dist --project-name=flugel-physics