Skip to content

Commit 5136fd1

Browse files
committed
chore: deploy via cloudflare pages
1 parent deb943c commit 5136fd1

3 files changed

Lines changed: 26 additions & 29 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
name: Test & Deploy
1+
name: Test & Deploy (Cloudflare Pages)
22

33
on:
44
push:
55
branches: ["main"]
66
workflow_dispatch:
77

8-
permissions:
9-
contents: read
10-
pages: write
11-
id-token: write
12-
13-
concurrency:
14-
group: "pages"
15-
cancel-in-progress: true
8+
env:
9+
NODE_VERSION: 20
10+
CLOUDFLARE_PAGES_PROJECT: certforge-dev
1611

1712
jobs:
1813
build:
@@ -21,29 +16,26 @@ jobs:
2116
steps:
2217
- name: Checkout
2318
uses: actions/checkout@v4
19+
2420
- name: Setup Node
2521
uses: actions/setup-node@v4
2622
with:
27-
node-version: 20
23+
node-version: ${{ env.NODE_VERSION }}
2824
cache: npm
25+
2926
- name: Install dependencies
3027
run: npm ci
28+
3129
- name: Run tests
3230
run: npm test
31+
3332
- name: Build site
3433
run: npm run build
35-
- name: Upload artifact
36-
uses: actions/upload-pages-artifact@v3
37-
with:
38-
path: dist
3934

40-
deploy:
41-
needs: build
42-
runs-on: ubuntu-latest
43-
environment:
44-
name: github-pages
45-
url: ${{ steps.deploy.outputs.page_url }}
46-
steps:
47-
- name: Deploy to GitHub Pages
48-
id: deploy
49-
uses: actions/deploy-pages@v4
35+
- name: Publish to Cloudflare Pages
36+
uses: cloudflare/pages-action@v1
37+
with:
38+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
39+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
40+
projectName: ${{ env.CLOUDFLARE_PAGES_PROJECT }}
41+
directory: dist

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# CertForge Static Site
22

3-
A lightweight Astro site that showcases every CertForge certification domain, links to the open-source prep repositories, and highlights the hands-on demos that live inside each repo. The site is optimized for GitHub Pages or Cloudflare Pages and enforces tests locally and in CI before deployments run.
3+
A lightweight Astro site that showcases every CertForge certification domain, links to the open-source prep repositories, and highlights the hands-on demos that live inside each repo. The site is optimized for Cloudflare Pages and enforces tests locally and in CI before deployments run.
44

55
## Tech Stack
66

77
- [Astro](https://astro.build) for the static site
88
- TypeScript modules for study-track data
99
- [Vitest](https://vitest.dev) for data integrity tests
1010
- [Husky](https://typicode.github.io/husky) git hooks to block commits when tests fail
11-
- GitHub Actions workflow for test + deploy to Pages
11+
- GitHub Actions workflow for Cloudflare Pages deployments
1212

1313
## Getting Started
1414

@@ -37,9 +37,14 @@ The workflow in `.github/workflows/deploy.yml` handles:
3737
1. `npm ci`
3838
2. `npm test`
3939
3. `npm run build`
40-
4. Upload + deploy to GitHub Pages
40+
4. Upload to Cloudflare Pages via `cloudflare/pages-action`
4141

42-
The static build artifacts live in `dist/`. Configure Pages to serve from the GitHub Actions workflow output. The same build directory can be uploaded to Cloudflare Pages if desired.
42+
Add the following GitHub Actions secrets before triggering the workflow:
43+
44+
- `CLOUDFLARE_API_TOKEN` — Pages write token scoped to the target account/project
45+
- `CLOUDFLARE_ACCOUNT_ID`
46+
47+
Update `projectName` inside the workflow if you change the Pages project slug. The build output directory remains `dist/`, which is what the action publishes.
4348

4449
## Project Structure
4550

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'astro/config';
22

33
export default defineConfig({
4-
site: 'https://certforge.github.io/GITHUB_README',
4+
site: 'https://certforge.dev',
55
integrations: [],
66
build: {
77
format: 'directory',

0 commit comments

Comments
 (0)