File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,13 +28,28 @@ jobs:
2828 - name : Build step
2929 run : deno task build
3030
31+ - name : Pre-render pages and assemble dist
32+ run : |
33+ set -e
34+ mkdir -p dist
35+ cp -r static/. dist/
36+ cp -r _fresh dist/
37+ deno run -A main.ts &
38+ SERVER_PID=$!
39+ trap 'kill $SERVER_PID 2>/dev/null || true' EXIT
40+ timeout 20 bash -c 'until curl -sf http://localhost:8000/ > /dev/null 2>&1; do sleep 1; done'
41+ mkdir -p dist/es dist/en
42+ curl -sf http://localhost:8000/ -o dist/index.html
43+ curl -sf http://localhost:8000/es -o dist/es/index.html
44+ curl -sf http://localhost:8000/en -o dist/en/index.html
45+
3146 - name : Upload build artifacts
3247 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
3348 uses : actions/upload-artifact@v4
3449 with :
3550 name : fresh-build
3651 path : |
37- _fresh /
52+ dist /
3853 retention-days : 1
3954
4055 deploy :
5469 uses : actions/download-artifact@v4
5570 with :
5671 name : fresh-build
57- path : _fresh /
72+ path : dist /
5873
5974 - name : Deploy to Cloudflare Workers
6075 uses : cloudflare/wrangler-action@v3
Original file line number Diff line number Diff line change 77
88# Fresh build directory
99_fresh /
10+ # Pre-rendered static output
11+ dist /
1012# npm dependencies
1113node_modules /
Original file line number Diff line number Diff line change 1+ // Cloudflare Workers entry point for the vibe-coding landing page.
2+ // The Fresh project is pre-rendered to static HTML during CI build (see deploy.yml).
3+ // All requests are served from the pre-rendered dist/ directory via the ASSETS binding.
4+ export default {
5+ async fetch ( request , env ) {
6+ if ( ! env . ASSETS ) {
7+ return new Response ( "Asset binding not configured" , { status : 500 } ) ;
8+ }
9+ return env . ASSETS . fetch ( request ) ;
10+ } ,
11+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " vibe-coding" ,
3- "main" : " ./server.ts " ,
3+ "main" : " ./server.js " ,
44 "compatibility_date" : " 2026-03-29" ,
55 "assets" : {
66 "binding" : " ASSETS" ,
7- "directory" : " ./static "
7+ "directory" : " ./dist "
88 },
99 "routes" : [
1010 {
You can’t perform that action at this time.
0 commit comments