Skip to content

Cloudflare Pages Setup

This repository publishes a static MkDocs site to Cloudflare Pages through GitHub Actions.

Architecture

GitHub repo
    |
    v
GitHub Actions
    |
    v
MkDocs build
    |
    v
Cloudflare Pages
    |
    v
Cloudflare Access, optional

Required GitHub Secrets

Add these in GitHub under Settings > Secrets and variables > Actions > Repository secrets:

Secret Purpose
CLOUDFLARE_API_TOKEN Token used by Wrangler to deploy to Cloudflare Pages.
CLOUDFLARE_ACCOUNT_ID Cloudflare account ID for the Pages project.

The API token should have Cloudflare Pages edit access for the account.

Cloudflare Pages Project

The workflow creates the Pages project if it does not already exist. The project name is:

ai-education-guides

The GitHub Actions workflow deploys the built site/ directory with:

wrangler pages deploy site --project-name=ai-education-guides --branch=main

The first production URL will be:

https://ai-education-guides.pages.dev

Custom DNS can be added later, but it is not required for the first publish.

Local Build

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
mkdocs serve

For a production build:

mkdocs build --strict

Deployment Flow

git push
    |
    v
GitHub Actions
    |
    v
MkDocs build
    |
    v
Cloudflare Pages deploy

If the Cloudflare secrets are not configured, the workflow still builds the site and skips the deploy step.