Skip to content

Commit fc11ae6

Browse files
author
patj
committed
Add Cloudflare Pages deploy pipeline (GitHub Actions + Wrangler)
- .github/workflows/deploy.yml: on push to main, stage site files into _site/ and 'wrangler pages deploy' to the 'aetherweb' project (Direct Upload). Self-bootstrapping (creates the project on first run); gated on CLOUDFLARE_API_TOKEN so it skips cleanly (green) until secrets are set. - README: full runbook — API token + account-id secrets, custom-domain attach (auto DNS + TLS), and apex->www redirect rule replacing the apex->GitHub one.
1 parent 0411e85 commit fc11ae6

2 files changed

Lines changed: 92 additions & 4 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy to Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: pages-deploy
13+
cancel-in-progress: true
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
env:
19+
# Mapped from the secret so we can gate steps on its presence — the
20+
# `secrets` context isn't available directly in step `if:` conditions.
21+
CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Check configuration
26+
if: ${{ env.CF_TOKEN == '' }}
27+
run: |
28+
echo "::notice::CLOUDFLARE_API_TOKEN not set — skipping deploy."
29+
echo "Add CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID repo secrets to enable it."
30+
31+
# Stage only the files the site actually serves — keep serve.py,
32+
# scripts/, dist/, README, and CI config out of the public deployment.
33+
- name: Stage site
34+
if: ${{ env.CF_TOKEN != '' }}
35+
run: |
36+
mkdir -p _site
37+
cp -R index.html 404.html styles.css assets _headers _site/
38+
[ -f _redirects ] && cp _redirects _site/ || true
39+
echo "Staged:" && find _site -maxdepth 2 -type f | sort
40+
41+
# First run creates the project; later runs no-op (hence continue-on-error).
42+
- name: Ensure Pages project exists
43+
if: ${{ env.CF_TOKEN != '' }}
44+
continue-on-error: true
45+
uses: cloudflare/wrangler-action@v3
46+
with:
47+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
48+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
49+
command: pages project create aetherweb --production-branch main
50+
51+
- name: Deploy
52+
if: ${{ env.CF_TOKEN != '' }}
53+
uses: cloudflare/wrangler-action@v3
54+
with:
55+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
56+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
57+
command: pages deploy _site --project-name=aetherweb --branch=main --commit-dirty=true

‎README.md‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,42 @@ python3 serve.py # http://127.0.0.1:4321
3131
python3 scripts/build.py # writes dist/index.html with CSS + images inlined
3232
```
3333

34-
## Deploy
34+
## Deploy — Cloudflare Pages
3535

36-
Cloudflare Pages pipeline — **to be added after design review.** The site is a
37-
plain static directory, so it deploys with zero build config (or `dist/` for the
38-
single-file variant).
36+
Deploys run from GitHub Actions via Wrangler (Direct Upload). Every push to
37+
`main` stages the site files into `_site/` and publishes them to the Pages
38+
project **`aetherweb`**. See [`.github/workflows/deploy.yml`](.github/workflows/deploy.yml).
39+
40+
### One-time setup
41+
42+
1. **Create a Cloudflare API token** — Cloudflare dashboard → *My Profile → API
43+
Tokens → Create Token → Custom token*. Permission: **Account → Cloudflare
44+
Pages → Edit**. Scope it to the AetherSDR account.
45+
2. **Grab the Account ID** — *Workers & Pages* overview (right sidebar).
46+
3. **Add two repo secrets** — GitHub → *Settings → Secrets and variables →
47+
Actions*:
48+
- `CLOUDFLARE_API_TOKEN`
49+
- `CLOUDFLARE_ACCOUNT_ID`
50+
4. **Push to `main`** (or run the workflow manually). The first run creates the
51+
`aetherweb` Pages project and publishes it to `https://aetherweb.pages.dev`.
52+
53+
### Domain (`www.aethersdr.com`)
54+
55+
The zone is already on Cloudflare, so DNS and TLS are automatic:
56+
57+
1. Pages project → **Custom domains → Set up a custom domain →
58+
`www.aethersdr.com`**. Cloudflare auto-creates the proxied CNAME and
59+
provisions the TLS cert.
60+
2. **Redirect the apex** — *Rules → Redirect Rules*: when hostname equals
61+
`aethersdr.com`, 301 to `https://www.aethersdr.com` (preserving path/query).
62+
This replaces the current apex → GitHub redirect. (If you still want a GitHub
63+
shortcut, point `code.aethersdr.com` at it instead.)
64+
65+
### Local manual deploy (optional)
66+
67+
```bash
68+
npx wrangler pages deploy . --project-name=aetherweb --branch=main
69+
```
3970

4071
---
4172

0 commit comments

Comments
 (0)