Skip to content

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.


  1. Push your repository to GitHub or GitLab.
  2. Log in to the Cloudflare Dashboard and navigate to Workers & Pages Create Application Pages Connect to Git.
  3. Select the Flugel-Physics repository.
  4. Set the build configurations:
    • Framework Preset: VitePress
    • Build Command: npm run docs:build
    • Build Output Directory: .vitepress/dist
    • Node.js Version: 20 (Set environment variable NODE_VERSION = 20 if necessary)
  5. Click Save and Deploy. Cloudflare Pages will automatically trigger a production build on every git push to main.

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-physics

Setting GitHub Secrets

In your GitHub repository Settings Secrets and variables Actions:

  • 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