跳转到内容

Cloudflare Workers 部署

你负责在 Cloudflare 控制台创建 Worker 并连接 Git,以下字段与仓库配置对应。

  1. 打开 Workers & Pages,选择创建 Worker。
  2. 选择 Connect to Git。
  3. 仓库:PlutoKeating/Project.UltraCode。
  4. 生产分支:main。
字段 填写
Root directory website
Build command bun run build
Build output directory dist
Deploy command bunx wrangler deploy
Install command bun install --frozen-lockfile
Bun version 1.3.14(若界面提供该字段)

如果控制台只有 Build command 和 Deploy command,保留默认安装行为即可。wrangler.jsonc 已声明静态资源目录为 ./dist。

本站是 Astro 静态输出。Cloudflare Workers Static Assets 直接发布 dist,install.sh 也会作为静态文本文件发布。

  • Pull Request 可生成预览构建。
  • main 发布 Stable 网站。
  • Next 是文档频道,不需要第二个 Worker。

当前生产地址为 https://project-ultracode.williamhvollita.workers.dev。需要自定义域名时,在 Custom Domains 添加并完成 DNS,再同步更新 Astro site 与安装示例。

终端窗口
cd website
bun install
bun run build
bunx wrangler deploy --dry-run

部署登录由你本人完成;本项目不会读取 Cloudflare 凭据。