Skip to content

feat(v1.16.0): 按依赖顺序将 workspace crate 发布到 crates.io - #95

Merged
zh30 merged 2 commits into
mainfrom
cursor/crates-io-publish-bedd
Sep 20, 2026
Merged

zh30 merged 2 commits into
mainfrom
cursor/crates-io-publish-bedd

Conversation

@zh30

@zh30 zh30 commented Sep 20, 2026

Copy link
Copy Markdown
Owner

变更范围

让 GitHub v* Release(现有 Release Assets 工作流)能可靠地把 workspace 发布到 crates.io,用户随后可 cargo install amberjs 得到 amber 二进制。

  1. path 依赖:根 Cargo.tomlamber_transpile / amber_sandbox 同时带 pathversion = "1.16.0"(与成员 crate 版本一致),否则 cargo publish 会被 path-only 依赖挡住。
  2. 成员元数据crates/amber_transpilecrates/amber_sandbox 补齐 descriptionlicense = "MIT"repositoryreadme 等 crates.io 字段。extensions/zedzed-amberjs)保持 publish = false,不会发布。
  3. 打包 include:原先按文件枚举的白名单漏了默认二进制实际编译的大量 src/ 模块,以及 include_str! 需要的 src/web_api/*.js。改为 /src/** + /types/** + build.rs / lock / README / LICENSE / bench 入口。不打包 target/node_modules/apps/benchmarks/ 等大树。打包估算约 2.0MB(crates.io 限 10MB)。
  4. Release Assets:在 GitHub Release / Homebrew / cosign 之后,用已有 secret CARGO_REGISTRY_TOKEN 按序 cargo publish -p
    • amber_transpile
    • amber_sandbox
    • amberjs
      token 为空仍跳过并打 warning;版本已存在则视为成功(workflow_dispatch 可重跑);crates.io 故障或索引延迟会重试,仍失败则 publish 步骤失败(Release 本身已经完成)。
  5. 文档:根 README、贡献指南、官网安装页说明 cargo install amberjs,以及 v* + CARGO_REGISTRY_TOKEN 驱动 crates.io。

影响模块

  • Cargo.tomlcrates/amber_transpilecrates/amber_sandbox
  • .github/workflows/release-assets.yml
  • tests/release_workflow_tests.rs
  • README.mddocs/CONTRIBUTING.mddocs/GITHUB_ACTIONS_RUNTIME_INFRASTRUCTURE.mdapps/website/src/docs/installation*.md

未改运行时行为,未改版本号。

如何验证

  1. 仓库 secret CARGO_REGISTRY_TOKEN 已由 Henry 配置,无需新 secret 名。
  2. 合并本 PR。
  3. 对已有 v* 标签跑 Release Assets 的 workflow_dispatch,或等下一次 v* tag。
  4. 查看 https://crates.io/crates/amberjs(以及 amber_transpileamber_sandbox)。
  5. cargo install amberjs 后应得到 amber

已跑检查

  • cargo metadata:path+version ^1.16.0zed-amberjs publish=false
  • cargo publish -p amber_transpile --dry-run --locked:通过(packaged 10 files, verify compile OK)。
  • cargo publish -p amber_sandbox --dry-run --locked:通过(packaged 8 files, verify compile OK)。
  • cargo package -p amberjs --locked --list --no-verify:694 个文件,含 src/lib.rssrc/main.rssrc/web_api/*.jstypes/amberjs.d.ts
  • cargo test --test release_workflow_tests --locked:23 passed。
  • cargo fmt

残留阻塞(已按 cargo 行为处理)

cargo publish -p amberjs --dry-run(即使 --no-verify)会在 crates.io 上还没有同版本 amber_transpile / amber_sandbox 时失败:

no matching package named `amber_sandbox` found
location searched: crates.io index

这是 cargo 把 path+version 依赖改成纯 version 后查 registry 的固有行为,不是清单漏文件。Release Assets 先发布两个成员 crate,并对 “no matching package named” / 已上传版本做重试或跳过,因此正式 v* 发布不受影响。未从本 agent 向 crates.io 做真实 publish。

相关文档

  • docs/GITHUB_ACTIONS_RUNTIME_INFRASTRUCTURE.md
  • docs/INFRASTRUCTURE_CAPABILITY_BACKLOG.md(0.4 crates.io 可见性)
  • docs/CONTRIBUTING.md 发布流程
Open in Web Open in Cursor 

为 amber_transpile / amber_sandbox 补齐 path+version 与 crates.io 元数据,
收紧并修正 amberjs 的 include 白名单,并在 Release Assets 中按依赖顺序
幂等发布(已存在版本跳过)。

Co-authored-by: Henry Zhang <hello@zhanghe.dev>
@changeset-bot

changeset-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3fcf819

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

本地 cargo publish --dry-run -p amberjs 在 amber_transpile / amber_sandbox
尚未上架时无法解析 version 依赖;Release Assets 会先发布这两个成员。

Co-authored-by: Henry Zhang <hello@zhanghe.dev>
@zh30
zh30 marked this pull request as ready for review September 20, 2026 23:56
@zh30
zh30 merged commit dc31b97 into main Sep 20, 2026
6 checks passed
@zh30 zh30 mentioned this pull request Sep 20, 2026
zh30 added a commit that referenced this pull request Sep 21, 2026
将 workspace crate 版本从 1.16.0 升到 1.16.1,使 v* 标签检出包含 #95 的 path+version 依赖与按序 crates.io 发布。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants