fix: handle direct upload Pages projects

This commit is contained in:
yoma committed 2026-07-14 20:40:24 +08:00
1 parent 0b1ab0d7df
commit a1ce678a11
4 files changed
+30 -17

No files matched your search

+5 -4
View File
@@ -28,10 +28,11 @@ EDGE_EVER_BUILDS_API_TOKEN=
# The selected build token must be able to apply D1 migrations and deploy Workers.
EDGE_EVER_BUILDS_BUILD_TOKEN_UUID=
# Optional: set this only when this repository also deploys an Astro/PAGES site.
# `bun run deploy:builds:setup` then limits that Pages project's Git builds to
# apps/site/* plus shared root dependency files. The User API Token also needs
# Account -> Cloudflare Pages -> Edit. Leave empty for normal EdgeEver forks.
# Optional: set this only for a Git-integrated Cloudflare Pages project.
# `bun run deploy:builds:setup` then limits its Git builds to apps/site/* plus
# shared root dependency files. The User API Token also needs Account ->
# Cloudflare Pages -> Edit. Direct Upload projects use their deploy workflow's
# path filters instead, so leave this empty for those projects.
EDGE_EVER_PAGES_PROJECT_NAME=
# Worker service name.
+3 -1
View File
@@ -39,7 +39,9 @@ This token is used only by `bun run deploy:builds:setup` and is never uploaded t
The Worker trigger already ignores changes limited to `apps/site/*`, `apps/mobile/*`, `apps/extension/*`, `docs/*`, README files, and `.github/*`. Thus a website-only change does not deploy the EdgeEver Worker.
For a Cloudflare Pages project in this repository, set `EDGE_EVER_PAGES_PROJECT_NAME` and rerun `bun run deploy:builds:setup`. The command configures Pages Build watch paths to `apps/site/*`, `bun.lock`, and `package.json`, so product-only changes do not rebuild the website. This optional step requires the User API Token to additionally have **Account** -> **Cloudflare Pages** -> **Edit**. Without automation, set the same paths in **Pages project** -> **Settings** -> **Build** -> **Build watch paths**.
For a Git-integrated Cloudflare Pages project, set `EDGE_EVER_PAGES_PROJECT_NAME` and rerun `bun run deploy:builds:setup`. The command configures Pages Build watch paths to `apps/site/*`, `bun.lock`, and `package.json`, so product-only changes do not rebuild the website. This optional step requires the User API Token to additionally have **Account** -> **Cloudflare Pages** -> **Edit**. Without automation, set the same paths in **Pages project** -> **Settings** -> **Build** -> **Build watch paths**.
Cloudflare cannot set Build watch paths on a **Direct Upload** Pages project. In that case, keep the filter in the deploy workflow instead. This repository's `.github/workflows/deploy-site.yml` already runs only for website/docs/shared-build-input changes, so application-only changes do not deploy the official site.
### Manual fallback
+3 -1
View File
@@ -40,7 +40,9 @@ Cloudflare 有两项账号级授权,仓库脚本不能、也不应该绕过:
Worker 触发器已经排除了仅发生在 `apps/site/*`、`apps/mobile/*`、`apps/extension/*`、`docs/*`、README 文件和 `.github/*` 中的变更。因此,仅改官网不会发布 EdgeEver Worker。
如果这个仓库还部署了 Cloudflare Pages 官网,请设置 `EDGE_EVER_PAGES_PROJECT_NAME`,再重跑 `bun run deploy:builds:setup`。命令会将 Pages 的 Build watch paths 设为 `apps/site/*`、`bun.lock`、`package.json`;这样仅改产品代码不会重新构建官网。该可选步骤要求 User API Token 额外拥有 **Account** -> **Cloudflare Pages** -> **Edit**。不使用自动化时,在 **Pages 项目** -> **Settings** -> **Build** -> **Build watch paths** 填入同样的路径即可。
如果这个仓库还部署了 **Git 集成** 的 Cloudflare Pages 官网,请设置 `EDGE_EVER_PAGES_PROJECT_NAME`,再重跑 `bun run deploy:builds:setup`。命令会将 Pages 的 Build watch paths 设为 `apps/site/*`、`bun.lock`、`package.json`;这样仅改产品代码不会重新构建官网。该可选步骤要求 User API Token 额外拥有 **Account** -> **Cloudflare Pages** -> **Edit**。不使用自动化时,在 **Pages 项目** -> **Settings** -> **Build** -> **Build watch paths** 填入同样的路径即可。
Cloudflare 无法为 **Direct Upload(直接上传)** 类型的 Pages 项目设置 Build watch paths;此时应由部署工作流本身过滤路径。本仓库的 `.github/workflows/deploy-site.yml` 已只监听官网、文档及共享构建输入的改动,因此仅改笔记应用不会触发官网部署。
### 手动兜底
+19 -11
View File
@@ -150,18 +150,26 @@ const triggerPayload = (workerTag, repoConnectionUuid, buildTokenUuid) => ({
const configurePagesWatchPaths = async () => {
if (!pagesProjectName) return;
await request("PATCH", `/accounts/${accountId}/pages/projects/${encodeURIComponent(pagesProjectName)}`, {
source: {
config: {
// `*` spans nested directories in Cloudflare Pages. Root lockfiles and
// package metadata are shared build inputs, so they intentionally trigger
// both projects when changed.
path_includes: ["apps/site/*", "bun.lock", "package.json"],
path_excludes: [],
try {
await request("PATCH", `/accounts/${accountId}/pages/projects/${encodeURIComponent(pagesProjectName)}`, {
source: {
config: {
// `*` spans nested directories in Cloudflare Pages. Root lockfiles and
// package metadata are shared build inputs, so they intentionally trigger
// both projects when changed.
path_includes: ["apps/site/*", "bun.lock", "package.json"],
path_excludes: [],
},
},
},
});
console.log(`[ok] configured Pages watch paths for ${pagesProjectName}`);
});
console.log(`[ok] configured Pages watch paths for ${pagesProjectName}`);
} catch (error) {
if (error instanceof Error && error.message.includes("Direct Uploads project")) {
console.log(`[skip] ${pagesProjectName} is a Direct Upload Pages project; its deploy workflow already controls path filtering.`);
return;
}
throw error;
}
};
const setup = async () => {