Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/deploy-cloudflare-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build and Deploy Cloudflare Worker

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 6 * * 1,4'

permissions:
contents: read

concurrency:
group: cloudflare-workers-production
cancel-in-progress: false

jobs:
validate-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Validate Worker deployment
run: pnpm wrangler deploy --dry-run

deploy:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: validate-and-build
runs-on: ubuntu-latest
environment:
name: cloudflare-workers-production
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Deploy static site
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: '4.107.1'
command: deploy
19 changes: 11 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy
name: Build and Deploy GitHub Pages

on:
push:
Expand All @@ -7,18 +7,21 @@ on:
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 6 * * 1,4'

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
group: github-pages
cancel-in-progress: false

jobs:
validate-and-build:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -36,20 +39,20 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Upload Pages artifact
if: github.ref == 'refs/heads/main'
- name: Upload GitHub Pages artifact
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: dist/

deploy:
if: github.ref == 'refs/heads/main'
needs: validate-and-build
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pnpm-debug.log*
.idea/

# Generated by local agent tooling
.codex/
.codebase-indexer/
.sentinel/
CLAUDE.md

# Cloudflare Wrangler local state
.wrangler/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ All commands are run from the root of the project, from a terminal:
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm astro -- --help` | Get help using the Astro CLI |

## Cloudflare Workers deployment

This site remains fully static. `wrangler.jsonc` publishes Astro's `dist/` output through Cloudflare Workers Static Assets; it does not add a server entrypoint, API routes, authentication, or database bindings.

- `pnpm deploy:dry-run` builds the site and validates the Worker asset deployment locally.
- `pnpm deploy` builds and deploys the static site with Wrangler.
- Pull requests run the static build and Wrangler dry-run validation.
- During this migration, GitHub Pages and Cloudflare Workers run as independent workflows. Each builds the site and deploys its own output on pushes, scheduled refreshes, and manual runs on `main`.

Before the first production deployment, repository administrators must create the `cloudflare-workers-production` environment and add these GitHub Actions secrets:

- `CLOUDFLARE_API_TOKEN` — a least-privilege token permitted to deploy this Worker.
- `CLOUDFLARE_ACCOUNT_ID` — the Cloudflare account that owns the Worker and `devcongress.org` zone.

The first deployment should be validated at its Workers preview URL. Attach `devcongress.org` only after URL/content parity checks pass. GitHub Pages continues to deploy independently during the agreed soak window and remains the rollback path.
## 👀 Want to learn more?

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"deploy": "pnpm build && wrangler deploy",
"deploy:dry-run": "pnpm build && wrangler deploy --dry-run",
"astro": "astro"
},
"dependencies": {
"astro": "^6.4.2",
"zod": "^4.4.3"
},
"devDependencies": {
"wrangler": "^4.107.1"
}
}
}
Loading
Loading