dsh-publish-helper 0.23.1 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,7 @@ DSH 插件上架 / 发布 / 撤回助手:发现、检查、生成 entry、开
12
12
  - `templates/release.yml`:GitHub Actions 发版工作流
13
13
  - `docs/plugin-vs-skill.md`:插件 vs 技能选型一页指南
14
14
  - `docs/ecosystem.md`:**生态定位**——插件配技能一套、互操作约定、token 账、交付清单
15
+ - `docs/trusted-publishing.md`:**不共享凭证的代发方式**(npm Trusted Publisher / OIDC)
15
16
 
16
17
  `publish_workflow` 默认写 **trusted publishing** 工作流(GitHub OIDC,无需长期 token);需要 secret 时传 `mode: "token"`。
17
18
 
@@ -0,0 +1,43 @@
1
+ # Trusted Publishing:不共享凭证的代发方式
2
+
3
+ > 来源:npm 官方 [Trusted publishing](https://docs.npmjs.com/trusted-publishers) 与 GitHub 社区讨论 #213917 的确认结论——npm **没有**「代理发布」功能;代发的官方正解是让作者自己的仓库通过 OIDC 发布。
4
+
5
+ ## 为什么用它
6
+
7
+ | 方式 | 作者要不要交 token | 谁的身份发布 | 可控性 |
8
+ |---|---|---|---|
9
+ | 维护者代发(作者的 token) | 要(有泄露风险) | 维护者 | 差 |
10
+ | **Trusted Publishing(本方案)** | **不要** | **作者自己的 npm 账号** | 作者随时可撤销 |
11
+ | npm org | 不要 | 组织 | 中 |
12
+
13
+ ## 配置步骤(作者侧,一次)
14
+
15
+ 1. npmjs.com → 包页面 → Settings → **Trusted Publisher** → 选 **GitHub Actions**
16
+ 2. 填:仓库 `owner/repo`、工作流 `release.yml`、可选 environment
17
+ 3. 作者仓库里的工作流使用:
18
+ ```yaml
19
+ permissions:
20
+ contents: read
21
+ id-token: write # OIDC + provenance
22
+ ```
23
+ 发布步骤:`npm publish --provenance --access public --ignore-scripts`(NODE_AUTH_TOKEN 留空)
24
+ 4. 推送 `v*` tag 或手动触发
25
+
26
+ `dsh-publish-helper` 的 `publish_workflow` 默认生成的就是这个工作流(`mode: trusted`)。
27
+
28
+ ## 作者保留的权利
29
+
30
+ - 可随时在 npm 设置里**撤销** Trusted Publisher
31
+ - 可要求每次发布在 GitHub environment 上**人工审批**(environment reviewers)
32
+ - 可下架 / 转回自己发;维护者不持有任何长期凭证
33
+
34
+ ## 维护者(你)的角色
35
+
36
+ - 提供 `release.yml` 模板、检查包质量、审核提交的 commit
37
+ - **不**接触作者的 npm token
38
+ - 发布记录由 GitHub Actions + provenance 自动生成(可追溯到仓库/commit/工作流)
39
+
40
+ ## 与「统一代发」的关系
41
+
42
+ - 作者愿意交出 npm token 才能用「统一代发」——不推荐,但保留入口
43
+ - 默认建议:**作者自持账号 + Trusted Publishing**,我们只提供工具链和审核
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-publish-helper",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "description": "DSH plugin publishing assistant: discover by topic, check listing readiness, generate the registry entry, open the pull request and show a settings page.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,9 +12,15 @@
12
12
  - 是否有 GitHub 账号:是 / 否(handle:)
13
13
  - 是否有 npm 账号:是 / 否(handle:)
14
14
  - 提交方式:自己开 PR / 请维护者代提
15
- - 发布方式:自己发 npm / 统一由维护者代发
15
+ - 发布方式:自己发 npm / **Trusted Publishing(作者仓库 CI 代发,零凭证共享,推荐)** / 统一由维护者代发
16
16
  - 代提/代发授权(选「请维护者」时必填):允许维护者代开 PR、代发 npm、保留作者署名、可随时下架/转回
17
17
 
18
+ ## Trusted Publishing(推荐,无凭证共享)
19
+
20
+ - 作者在 npm 包设置里配置 Trusted Publisher(GitHub Actions,仓库 + `release.yml`)
21
+ - 工作流由 `dsh-publish-helper` 的 `publish_workflow` 生成(`mode: trusted`)
22
+ - 作者保留撤销权 / 可加 environment 人工审批;维护者不持有凭证
23
+
18
24
  ## 源码
19
25
 
20
26
  - 仓库:
@@ -27,6 +33,7 @@
27
33
  - 是否使用 org scope(如 @dsh-community/xxx):
28
34
  - 当前 npm 版本(如已发布):
29
35
  - 是否需要代发:是 / 否
36
+ - 代发方式:Trusted Publishing(推荐)/ 维护者代发
30
37
  - 代发授权(代发时必填):允许维护者发布、保留署名、可随时下架/转回
31
38
 
32
39
  ## 撤回