From 744bb0e693d2566313257cb8b0882a8845087a7a Mon Sep 17 00:00:00 2001 From: XiaoDaiGua-Ray <51957438+XiaoDaiGua-Ray@users.noreply.github.com> Date: Fri, 6 Nov 2026 22:21:21 +0800 Subject: [PATCH] build(pages): publish directly on every main push --- .github/workflows/ci.yaml | 36 ++++++++++-------------------------- AGENTS.md | 2 +- README.md | 2 +- README.zh-CN.md | 2 +- apps/docs/guide/tooling.md | 4 ++-- docs/architecture.md | 2 +- docs/toolchain-upgrade.md | 17 ++++++++++++++++- harness/README.md | 2 +- harness/plan.md | 2 +- 9 files changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a8d7a599..93d186a3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,8 +1,8 @@ -name: CI +name: Pages on: push: - pull_request: + branches: [main] workflow_dispatch: permissions: @@ -13,28 +13,9 @@ concurrency: cancel-in-progress: true jobs: - check: - name: Check (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v7.0.1 - - uses: actions/setup-node@v7.1.0 - with: - node-version-file: .nvmrc - - uses: pnpm/action-setup@v6.1.0 - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Check the app and documentation workspace - run: pnpm check - deploy: - name: Deploy main to dist branch - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - needs: check + name: Build and publish Pages + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: write @@ -44,12 +25,15 @@ jobs: with: node-version-file: .nvmrc - uses: pnpm/action-setup@v6.1.0 - - run: pnpm install --frozen-lockfile - - run: pnpm pages:build + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Build admin and documentation + run: pnpm pages:build env: RAY_TEMPLATE_SITE_ORIGIN: ${{ github.repository == 'XiaoDaiGua-Ray/ray-template' && 'https://xiaodaigua-ray.github.io' || vars.RAY_TEMPLATE_SITE_ORIGIN }} RAY_TEMPLATE_SOURCE_REF: ${{ github.sha }} - - uses: JamesIves/github-pages-deploy-action@v4.9.0 + - name: Publish combined site to dist + uses: JamesIves/github-pages-deploy-action@v4.9.0 with: branch: dist folder: dist/pages diff --git a/AGENTS.md b/AGENTS.md index 7925063a..2d29bb3b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,5 +8,5 @@ A Vue 3 + TSX admin template with an admin application, a documentation site, an - Write agent guidance and internal engineering documentation in English. Preserve the intended languages of product copy and reader-facing documentation. - Follow the [comment style](docs/comment-style.md) when adding or editing comments. Maintain both Chinese and English product copy. For visible behavior changes, use [browser verification](harness/README.md#browser-verification) only for affected pages, actions, and dimensions. - For custom CSS, follow the [style contract](docs/ui-design.md#custom-css-contract): consume semantic theme tokens and the shell's runtime layout variables so style, color mode, primary color, and layout preferences keep working. Keep provider ownership and scoped overrides explicit. -- Select relevant tests or `pnpm harness verify ` using the [verification scope](harness/README.md#choosing-the-verification-scope). Small changes do not default to full checks or a UI/UX sweep. Use full checks for integration risk, releases, or an explicit request; CI keeps `pnpm check`. Within one task, rerun only checks affected by subsequent changes. Report what was and was not verified. +- Select relevant tests or `pnpm harness verify ` using the [verification scope](harness/README.md#choosing-the-verification-scope). Small changes do not default to full checks or a UI/UX sweep. Use full checks for integration risk, releases, or an explicit request. Pages builds and publishes on main independently of full verification. Within one task, rerun only checks affected by subsequent changes. Report what was and was not verified. - Establish engineering facts from current source, manifests, and the lockfile. Keep sensitive data out of source, prompts, and evidence. Commits, pushes, and deployments require user authorization. diff --git a/README.md b/README.md index a370f363..df1b1345 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ In the complete repository, `pnpm check` also checks server types, tests, and bu -CI is configured for **Linux, Windows, and macOS**. Read [AGENTS.md](AGENTS.md) and the [Harness verification guide](harness/README.md) before contributing. Default deployment paths are `/ray-template/` for the admin and `/ray-template/docs/` for documentation. See the [deployment guidance](docs/architecture.md#deployment-and-search-discovery) before changing them. +The **Pages workflow** builds the admin and documentation on every push to `main` and publishes successful output to `dist`. It has no path filter or cross-platform check dependency; manual publication on `main` is also supported. Read [AGENTS.md](AGENTS.md) and the [Harness verification guide](harness/README.md) before contributing. Default deployment paths are `/ray-template/` for the admin and `/ray-template/docs/` for documentation. See the [deployment guidance](docs/architecture.md#deployment-and-search-discovery) before changing them. ## Version boundaries diff --git a/README.zh-CN.md b/README.zh-CN.md index 7ac0ff96..c5ad5b51 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -190,7 +190,7 @@ pnpm dev:full -CI 配置覆盖 **Linux、Windows 与 macOS**。贡献前阅读 [AGENTS.md](AGENTS.md) 与 [Harness 验证说明](harness/README.md)。默认部署路径为后台 `/ray-template/`、文档 `/ray-template/docs/`,修改前请查看[部署约定](docs/architecture.md#deployment-and-search-discovery)。 +**Pages 工作流**在 `main` 每次 push 后构建后台与文档,成功后发布到 `dist`。不设路径过滤,不依赖三平台检查,也支持在 `main` 手动重发。贡献前阅读 [AGENTS.md](AGENTS.md) 与 [Harness 验证说明](harness/README.md)。默认部署路径为后台 `/ray-template/`、文档 `/ray-template/docs/`,修改前请查看[部署约定](docs/architecture.md#deployment-and-search-discovery)。 ## 版本边界 diff --git a/apps/docs/guide/tooling.md b/apps/docs/guide/tooling.md index 9b07a7b1..72cfdb10 100644 --- a/apps/docs/guide/tooling.md +++ b/apps/docs/guide/tooling.md @@ -18,7 +18,7 @@ | `pnpm docs:check` | 验证文档示例类型、站内链接与生产构建 | | `pnpm docs:preview` | 预览已构建的文档站 | -日常修改先运行相关测试文件或 `pnpm harness verify `,再根据改动补充格式、ESLint 和类型检查。纯措辞、注释或维护文档修正可只检查内容和格式;索引变化加 `pnpm harness check`。依赖、公共导出、构建配置等集成风险、发布或明确要求时,才在任务收尾运行一次全量检查。CI 保持 `pnpm check`。 +日常修改先运行相关测试文件或 `pnpm harness verify `,再根据改动补充格式、ESLint 和类型检查。纯措辞、注释或维护文档修正可只检查内容和格式;索引变化加 `pnpm harness check`。依赖、公共导出、构建配置等集成风险、发布或明确要求时,才在任务收尾运行一次全量检查。Pages 发布独立运行构建,本地全量检查入口仍为 `pnpm check`。 全量检查包含环境、Harness、API 与包边界、图标同步、类型、ESLint、Prettier、Vitest,以及后台和文档构建。`pnpm harness verify` 省略 scope 时仍执行全量,日常使用应显式指定 scope。Harness 在 `.harness-local/runs/` 写命令结果,所有命令均不启动浏览器。 @@ -28,7 +28,7 @@ `pnpm build` 输出 `dist/production`。将产物部署到与 `vite.custom.config.ts` 中 `base` 对应的路径。默认应用为 `/ray-template/`,域名根目录部署改为 `/`。Vite 默认打包本地依赖;可选 CDN 模式需另外确认目标环境能访问 CDN。 -组合部署使用 `pnpm pages:build`,将 `dist/pages` 作为同一个站点的产物。官方地址为 `/ray-template/`,其下 `docs/` 目录提供 v6 官网。CI 传入 `RAY_TEMPLATE_SOURCE_REF`,把文档的当前源码链接固定到发布提交。 +组合部署使用 `pnpm pages:build`,将 `dist/pages` 作为同一个站点的产物。官方地址为 `/ray-template/`,其下 `docs/` 目录提供 v6 官网。Pages 工作流在 `main` 每次 push 后于 Ubuntu 构建,成功后发布到 `dist` 分支;不设路径过滤,也不依赖三平台检查,因此后台、文档、共享包、依赖和构建配置变动都会触发。支持在 `main` 手动重发,其他分支和 PR 不发布到正式站点。构建时传入 `RAY_TEMPLATE_SOURCE_REF`,把文档的当前源码链接固定到发布提交。 公开生产部署可在构建环境设置 `RAY_TEMPLATE_SITE_ORIGIN` 为实际站点源地址(例如 `https://example.com`),由 base 补足路径。未配置时应用产物使用 `noindex`。公开 sitemap 列出入口页,登录后的 hash 路由用于应用交互。 diff --git a/docs/architecture.md b/docs/architecture.md index 5de64ee4..2a36e0a5 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -79,7 +79,7 @@ The [root configuration](../tsconfig.json) references four projects. Strict mode `pnpm build` produces admin output in `dist/production`; `pnpm docs:build` produces `apps/docs/.vitepress/dist`. `pnpm pages:build` combines them in `dist/pages`, with documentation under `docs/`. The default admin base is `/ray-template/`; the documentation base is `/ray-template/docs/`. For root hosting or another subpath, align the [admin base](../vite.custom.config.ts), [documentation base](../apps/docs/.vitepress/config.mts), and [legacy redirect targets](../scripts/assemble-pages.mjs). -After main-branch checks pass, [CI](../.github/workflows/ci.yaml) publishes the combined output to the `dist` branch. The [admin public .nojekyll file](../apps/admin/public/.nojekyll) is copied into the output. Preserve it when deploying manually to Pages so assets with underscore prefixes can load. +Every push to `main` triggers the [Pages workflow](../.github/workflows/ci.yaml), which runs `pnpm pages:build` on Ubuntu and publishes successful output to the `dist` branch. No path filter or separate verification job gates this build, so application, documentation, shared-package, dependency, and tooling changes all trigger publication. Manual dispatch publishes only when run on `main`; generated `dist` and `frontend` branches do not trigger the workflow. The [admin public .nojekyll file](../apps/admin/public/.nojekyll) is copied into the output. Preserve it when deploying manually to Pages so assets with underscore prefixes can load. For public builds, set `RAY_TEMPLATE_SITE_ORIGIN` to the actual site origin; the base supplies the path. Without it, admin production builds emit `noindex`. The public admin landing page generates canonical metadata, sharing previews, and `sitemap.xml`; authenticated hash routes are not listed as public pages. Domain-level crawling rules belong in `/robots.txt` at the site root. [VitePress mappings](../apps/docs/.vitepress/legacy.mts) generate legacy in-site links. When a site origin is configured, the assembly script also generates `dist/legacy-docs` for migrating the old site. diff --git a/docs/toolchain-upgrade.md b/docs/toolchain-upgrade.md index 13638e4d..b3e7a42a 100644 --- a/docs/toolchain-upgrade.md +++ b/docs/toolchain-upgrade.md @@ -236,7 +236,7 @@ Translated agent entry points, Harness topics and workflow, internal architectur ### Remote CI follow-up -The [historical Ubuntu failure](https://github.com/XiaoDaiGua-Ray/ray-template/actions/runs/41588971650) was in `detectOperatingSystem.spec.ts`: the test read the Linux runner's actual user agent but always expected `Unknown`. Commit `83bada95` covers systems with mocked user agents and touch-point counts. [CI](https://github.com/XiaoDaiGua-Ray/ray-template/actions/runs/41612553267) for recorded baseline `80e80775` passed Ubuntu, macOS, Windows, and deployment. The matrix continues to run the same `pnpm check`. +The [historical Ubuntu failure](https://github.com/XiaoDaiGua-Ray/ray-template/actions/runs/41588971650) was in `detectOperatingSystem.spec.ts`: the test read the Linux runner's actual user agent but always expected `Unknown`. Commit `83bada95` covers systems with mocked user agents and touch-point counts. [CI](https://github.com/XiaoDaiGua-Ray/ray-template/actions/runs/41612553267) for recorded baseline `80e80775` passed Ubuntu, macOS, Windows, and deployment. At that checkpoint, the matrix ran the same `pnpm check` on all three systems. @@ -254,3 +254,18 @@ The server pins JOSE 6.2.12 for JWT signing and verification. The browser defaul The [PC acceptance record](../harness/fullstack-acceptance.md) contains the full Harness, real PostgreSQL/Redis, clean archive, Docker Compose and desktop Chrome results. It also records the external-service upgrade and the required sign-in after replacing legacy tokens. No remote workflow or public deployment was used. + +## 2026-11-06: Direct Pages builds on main + +Removed the Ubuntu/Windows/macOS verification matrix and the deployment job's dependency on it. The existing workflow file now contains one Pages job: every push to `main` builds the admin and documentation with `pnpm pages:build`, then publishes successful output to `dist`. It deliberately has no path filter, so shared packages, dependencies, tooling, and documentation cannot be omitted from the deployment trigger. Backend-only and maintenance changes also trigger a build. Manual dispatch is restricted to `main`; PRs and generated branches do not publish. The separate source-distributions workflow remains unchanged. + +Updated contributor guidance, both READMEs, architecture, and the reader tooling guide to distinguish local full verification from Pages publication. The build command, deployment branch, site paths, source-reference environment, and `.nojekyll` behavior are unchanged. + +Local verification used Node.js 26.13.0 and pnpm 12.16.1: + +- Parsed the workflow YAML and checked main pushes, manual dispatch, excluded branches, removal of the check dependency, and successful-build-before-publication ordering. +- `pnpm harness verify all` passed environment, index, contract, boundary, type, lint, and format checks; 106 frontend test files / 552 cases; and both production site builds. It then stopped because the sandbox blocked the server tests from listening on loopback. Report: `.harness-local/runs/all-8AOcdZ/report.json`. +- Re-ran only `pnpm server:check` with loopback permission: server types, 12 tests, and build passed. The optional real Redis test was skipped. The remaining `pnpm dist:check` passed for both source editions. +- Reused the completed site builds for `node scripts/assemble-pages.mjs`; confirmed both entry pages, `.nojekyll`, the Mock worker, and both API contract files in `dist/pages`. + +Remote Actions and public deployment results were not inspected. No application rendering or asset-path behavior changed, so browser acceptance was not repeated. diff --git a/harness/README.md b/harness/README.md index 825c8252..95038d4d 100644 --- a/harness/README.md +++ b/harness/README.md @@ -59,7 +59,7 @@ For example, a CSV escaping fix can use `pnpm test:run __test__/components/table `verify` runs steps sequentially, stops at the first failure, and returns a nonzero exit code. It prints the path to `.harness-local/runs//report.json` on completion. Reports contain commands, outcomes, durations, runtime, and signals; each invocation has a separate record. Full reports represent `pnpm check` as one step; consult that run's terminal output for phase details. Invalid arguments or context, and forcibly interrupted runs, may produce no report. None of these CLI commands launches a browser. Passing command checks does not establish UI/UX acceptance. -GitHub Actions runs the same `pnpm check` on Linux, Windows, and macOS. Use `pnpm lint`, `pnpm format:check`, or `pnpm typecheck` separately to diagnose failures. `pnpm lint:fix` and `pnpm format` rewrite files. `pnpm check` synchronizes icon manifests and generates `dist/production`; review generated diffs before delivery. +The Pages workflow runs `pnpm pages:build` on Ubuntu for every push to `main`, then publishes the combined site to `dist`. It has no path filter or cross-platform check dependency and can also be run manually on `main`. Local full verification remains `pnpm check`; select it using the rules above. Use `pnpm lint`, `pnpm format:check`, or `pnpm typecheck` separately to diagnose failures. `pnpm lint:fix` and `pnpm format` rewrite files. `pnpm check` synchronizes icon manifests and generates `dist/production`; review generated diffs before delivery. ### Browser verification diff --git a/harness/plan.md b/harness/plan.md index 0216d01c..5ddde55d 100644 --- a/harness/plan.md +++ b/harness/plan.md @@ -112,6 +112,6 @@ These sources offer practices, not a uniform Harness certification or directory - All 10 topics are reachable from the static entry point. Each of the 81 enumerated `.spec.ts/.spec.tsx` files belongs to at least one scope. Index validation establishes path existence and valid targets, not accurate prose or sufficient behavior coverage. - `ui` covers 37 test files and is suitable for scope-level regressions. A single-behavior fix can run its test file directly and record the result in the delivery note. Reuse existing entry points without adding a second system to infer scope from Git diffs and dependencies. -- Preserve full checks when scope is omitted for command compatibility. Everyday guidance should show an explicit scope. Keep CI's three-platform `pnpm check` and deployment dependencies unchanged. +- Preserve full checks when scope is omitted for command compatibility. Everyday guidance should show an explicit scope. This checkpoint retained CI's three-platform `pnpm check` and deployment dependencies; the later [direct Pages build change](../docs/toolchain-upgrade.md#2026-11-06-direct-pages-builds-on-main) supersedes that CI arrangement. - Continue writing local reports to `.harness-local/`, excluded from Git, lint/format scans, and package inputs. Full-report phase details still depend on terminal output. Record browser evidence separately; static checks do not prove runtime success. - Regressions cover targeted commands not appending full checks, stopping on generated-artifact check failure, and compatibility of explicit/legacy full-check entry points. Actual run results are in the [toolchain record](../docs/toolchain-upgrade.md). This change has no page effect and needs no UI/UX verification.