@intentius/chant 0.124.100 → 0.124.102

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.
Files changed (270) hide show
  1. package/dist/action-pins.d.ts +2 -0
  2. package/dist/action-pins.js +3 -0
  3. package/dist/ci-detect.d.ts +13 -0
  4. package/dist/ci-detect.js +12 -0
  5. package/dist/ci-evidence-claims.d.ts +12 -0
  6. package/dist/ci-evidence-claims.js +12 -0
  7. package/dist/ci-system.d.ts +66 -0
  8. package/dist/ci-system.js +61 -0
  9. package/dist/cli/handlers/build.js +27 -0
  10. package/dist/cli/handlers/release-doctor.d.ts +12 -0
  11. package/dist/cli/handlers/release-doctor.js +118 -0
  12. package/dist/cli/handlers/release-init.d.ts +10 -0
  13. package/dist/cli/handlers/release-init.js +374 -0
  14. package/dist/cli/handlers/release.d.ts +43 -2
  15. package/dist/cli/handlers/release.js +667 -39
  16. package/dist/cli/handlers/run-generate.js +11 -0
  17. package/dist/cli/main.d.ts +2 -0
  18. package/dist/cli/main.js +44 -101
  19. package/dist/cli/parse-args.js +48 -0
  20. package/dist/cli/registry.d.ts +16 -0
  21. package/dist/cli/release-commands/artifacts.d.ts +3 -0
  22. package/dist/cli/release-commands/artifacts.js +14 -0
  23. package/dist/cli/release-commands/candidates.d.ts +3 -0
  24. package/dist/cli/release-commands/candidates.js +16 -0
  25. package/dist/cli/release-commands/changed.d.ts +3 -0
  26. package/dist/cli/release-commands/changed.js +14 -0
  27. package/dist/cli/release-commands/compose.d.ts +3 -0
  28. package/dist/cli/release-commands/compose.js +16 -0
  29. package/dist/cli/release-commands/cut.d.ts +3 -0
  30. package/dist/cli/release-commands/cut.js +50 -0
  31. package/dist/cli/release-commands/doctor.d.ts +3 -0
  32. package/dist/cli/release-commands/doctor.js +14 -0
  33. package/dist/cli/release-commands/export.d.ts +3 -0
  34. package/dist/cli/release-commands/export.js +12 -0
  35. package/dist/cli/release-commands/images.d.ts +3 -0
  36. package/dist/cli/release-commands/images.js +13 -0
  37. package/dist/cli/release-commands/index.d.ts +8 -0
  38. package/dist/cli/release-commands/index.js +52 -0
  39. package/dist/cli/release-commands/init.d.ts +3 -0
  40. package/dist/cli/release-commands/init.js +19 -0
  41. package/dist/cli/release-commands/list.d.ts +3 -0
  42. package/dist/cli/release-commands/list.js +10 -0
  43. package/dist/cli/release-commands/next.d.ts +3 -0
  44. package/dist/cli/release-commands/next.js +13 -0
  45. package/dist/cli/release-commands/publish.d.ts +3 -0
  46. package/dist/cli/release-commands/publish.js +22 -0
  47. package/dist/cli/release-commands/stamp.d.ts +3 -0
  48. package/dist/cli/release-commands/stamp.js +15 -0
  49. package/dist/cli/release-commands/status.d.ts +3 -0
  50. package/dist/cli/release-commands/status.js +17 -0
  51. package/dist/cli/release-commands/tag.d.ts +3 -0
  52. package/dist/cli/release-commands/tag.js +12 -0
  53. package/dist/cli/release-commands/types.d.ts +20 -0
  54. package/dist/cli/release-commands/types.js +1 -0
  55. package/dist/cli/release-commands/verify.d.ts +3 -0
  56. package/dist/cli/release-commands/verify.js +15 -0
  57. package/dist/cli/release-commands/workflow.d.ts +3 -0
  58. package/dist/cli/release-commands/workflow.js +15 -0
  59. package/dist/cloud-lister/index.d.ts +4 -1
  60. package/dist/cloud-lister/index.js +2 -1
  61. package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
  62. package/dist/cloud-lister/kubernetes-components.js +642 -0
  63. package/dist/cloud-lister/kubernetes.d.ts +18 -0
  64. package/dist/cloud-lister/kubernetes.js +26 -1
  65. package/dist/cloud-lister/mask.d.ts +5 -1
  66. package/dist/cloud-lister/mask.js +14 -5
  67. package/dist/components/cli-support.d.ts +1 -1
  68. package/dist/components/cli-support.js +1 -1
  69. package/dist/config-environments.d.ts +8 -1
  70. package/dist/config-environments.js +2 -0
  71. package/dist/config-import.d.ts +1 -1
  72. package/dist/config-import.js +6 -2
  73. package/dist/config-sandbox.d.ts +1 -1
  74. package/dist/config-sandbox.js +3 -3
  75. package/dist/config.d.ts +369 -10
  76. package/dist/config.js +127 -7
  77. package/dist/deep-observation.js +9 -3
  78. package/dist/floor-table.data.js +21 -1
  79. package/dist/forge-remote.d.ts +13 -0
  80. package/dist/forge-remote.js +15 -0
  81. package/dist/lexicon.d.ts +45 -4
  82. package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
  83. package/dist/lifecycle/__fixtures__/package-files.js +72 -0
  84. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
  85. package/dist/lifecycle/__fixtures__/publish-fakes.js +275 -3
  86. package/dist/lifecycle/publish-attachments.d.ts +2 -1
  87. package/dist/lifecycle/publish-attachments.js +19 -2
  88. package/dist/lifecycle/publish-cargo.d.ts +99 -0
  89. package/dist/lifecycle/publish-cargo.js +412 -0
  90. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  91. package/dist/lifecycle/publish-credentials.js +13 -0
  92. package/dist/lifecycle/publish-declaration.d.ts +322 -4
  93. package/dist/lifecycle/publish-declaration.js +340 -9
  94. package/dist/lifecycle/publish-forge.d.ts +45 -2
  95. package/dist/lifecycle/publish-forge.js +434 -34
  96. package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
  97. package/dist/lifecycle/publish-git-ssh.js +30 -4
  98. package/dist/lifecycle/publish-github.d.ts +40 -2
  99. package/dist/lifecycle/publish-github.js +100 -3
  100. package/dist/lifecycle/publish-helm.d.ts +83 -0
  101. package/dist/lifecycle/publish-helm.js +452 -0
  102. package/dist/lifecycle/publish-homebrew.d.ts +7 -9
  103. package/dist/lifecycle/publish-homebrew.js +34 -197
  104. package/dist/lifecycle/publish-index.d.ts +141 -0
  105. package/dist/lifecycle/publish-index.js +719 -0
  106. package/dist/lifecycle/publish-marketplace.js +77 -0
  107. package/dist/lifecycle/publish-maven.d.ts +79 -0
  108. package/dist/lifecycle/publish-maven.js +364 -0
  109. package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
  110. package/dist/lifecycle/publish-mcp-registry.js +305 -0
  111. package/dist/lifecycle/publish-npm.d.ts +27 -1
  112. package/dist/lifecycle/publish-npm.js +216 -3
  113. package/dist/lifecycle/publish-nuget.d.ts +93 -0
  114. package/dist/lifecycle/publish-nuget.js +377 -0
  115. package/dist/lifecycle/publish-oci.d.ts +91 -2
  116. package/dist/lifecycle/publish-oci.js +247 -8
  117. package/dist/lifecycle/publish-package-files.d.ts +16 -0
  118. package/dist/lifecycle/publish-package-files.js +39 -0
  119. package/dist/lifecycle/publish-pypi.d.ts +138 -0
  120. package/dist/lifecycle/publish-pypi.js +657 -0
  121. package/dist/lifecycle/publish-record.d.ts +6 -3
  122. package/dist/lifecycle/publish-record.js +6 -3
  123. package/dist/lifecycle/publish-rubygems.d.ts +84 -0
  124. package/dist/lifecycle/publish-rubygems.js +366 -0
  125. package/dist/lifecycle/publish-signing.d.ts +147 -0
  126. package/dist/lifecycle/publish-signing.js +257 -0
  127. package/dist/lifecycle/publish-targets.d.ts +37 -1
  128. package/dist/lifecycle/publish-targets.js +102 -0
  129. package/dist/lifecycle/publish-tauri.js +43 -0
  130. package/dist/lifecycle/publish-train-names.d.ts +57 -0
  131. package/dist/lifecycle/publish-train-names.js +123 -0
  132. package/dist/lifecycle/publish-verify.d.ts +121 -0
  133. package/dist/lifecycle/publish-verify.js +130 -0
  134. package/dist/lifecycle/query.js +8 -0
  135. package/dist/lifecycle/release-artifacts.d.ts +290 -0
  136. package/dist/lifecycle/release-artifacts.js +808 -0
  137. package/dist/lifecycle/release-changelog.d.ts +13 -1
  138. package/dist/lifecycle/release-changelog.js +35 -2
  139. package/dist/lifecycle/release-cut.d.ts +64 -4
  140. package/dist/lifecycle/release-cut.js +147 -34
  141. package/dist/lifecycle/release-doctor.d.ts +113 -0
  142. package/dist/lifecycle/release-doctor.js +1198 -0
  143. package/dist/lifecycle/release-green.d.ts +86 -0
  144. package/dist/lifecycle/release-green.js +286 -0
  145. package/dist/lifecycle/release-init-registries.d.ts +48 -0
  146. package/dist/lifecycle/release-init-registries.js +97 -0
  147. package/dist/lifecycle/release-init.d.ts +275 -0
  148. package/dist/lifecycle/release-init.js +984 -0
  149. package/dist/lifecycle/release-intents.d.ts +73 -0
  150. package/dist/lifecycle/release-intents.js +128 -0
  151. package/dist/lifecycle/release-next.d.ts +111 -0
  152. package/dist/lifecycle/release-next.js +251 -0
  153. package/dist/lifecycle/release-prerelease.d.ts +19 -0
  154. package/dist/lifecycle/release-prerelease.js +30 -0
  155. package/dist/lifecycle/release-publish.d.ts +256 -10
  156. package/dist/lifecycle/release-publish.js +247 -35
  157. package/dist/lifecycle/release-status-change.d.ts +226 -0
  158. package/dist/lifecycle/release-status-change.js +478 -0
  159. package/dist/lifecycle/release-status.d.ts +11 -0
  160. package/dist/lifecycle/release-status.js +1 -1
  161. package/dist/lifecycle/release-store.d.ts +73 -2
  162. package/dist/lifecycle/release-store.js +32 -1
  163. package/dist/lifecycle/release-tag.d.ts +142 -0
  164. package/dist/lifecycle/release-tag.js +322 -0
  165. package/dist/lifecycle/release-verify.d.ts +73 -1
  166. package/dist/lifecycle/release-verify.js +117 -2
  167. package/dist/lifecycle/release-version-formats.d.ts +73 -0
  168. package/dist/lifecycle/release-version-formats.js +570 -0
  169. package/dist/lifecycle/release-version.d.ts +58 -10
  170. package/dist/lifecycle/release-version.js +164 -36
  171. package/dist/lifecycle/release-workstation.d.ts +3 -2
  172. package/dist/lifecycle/release-workstation.js +3 -2
  173. package/dist/op/generate-pipeline.js +1 -1
  174. package/dist/op/local-executor.d.ts +1 -1
  175. package/dist/op/local-executor.js +2 -2
  176. package/dist/op/op-waves-evidence.js +9 -2
  177. package/dist/pr-forge-base.js +4 -2
  178. package/dist/pr-forge.d.ts +20 -2
  179. package/dist/pr-forge.js +46 -10
  180. package/dist/release-floors.d.ts +8 -1
  181. package/dist/release-floors.js +9 -2
  182. package/dist/sensitive-key.d.ts +12 -0
  183. package/dist/sensitive-key.js +52 -0
  184. package/dist/tool-pins.d.ts +40 -0
  185. package/dist/tool-pins.js +66 -0
  186. package/dist/ts-loader.d.ts +8 -0
  187. package/dist/ts-loader.js +19 -0
  188. package/dist/wave-runtime.mjs +345 -342
  189. package/dist/workspace/ci-forge.d.ts +17 -0
  190. package/dist/workspace/ci-forge.js +17 -0
  191. package/dist/workspace/ci-init.js +1 -1
  192. package/dist/workspace/composites.schema.json +1 -0
  193. package/dist/workspace/declaration.d.ts +8 -0
  194. package/dist/workspace/declaration.js +12 -0
  195. package/dist/workspace/declaration.schema.json +8 -0
  196. package/dist/workspace/environments.d.ts +2 -0
  197. package/dist/workspace/environments.js +1 -1
  198. package/dist/workspace/identity-gate-rule.d.ts +61 -5
  199. package/dist/workspace/identity-gate-rule.js +81 -12
  200. package/dist/workspace/lexicon-outputs.d.ts +1 -1
  201. package/dist/workspace/lexicon-outputs.js +1 -1
  202. package/dist/workspace/member-pipeline.d.ts +2 -1
  203. package/dist/workspace/member-pipeline.js +5 -2
  204. package/dist/workspace/reason-codes.d.ts +2 -0
  205. package/dist/workspace/reason-codes.js +3 -1
  206. package/dist/workspace/release-changed.d.ts +75 -4
  207. package/dist/workspace/release-changed.js +205 -34
  208. package/dist/workspace/release-changed.schema.json +20 -2
  209. package/dist/workspace/release-steps/artifacts.d.ts +7 -0
  210. package/dist/workspace/release-steps/artifacts.js +45 -0
  211. package/dist/workspace/release-steps/builds.d.ts +12 -0
  212. package/dist/workspace/release-steps/builds.js +38 -0
  213. package/dist/workspace/release-steps/doctor.d.ts +8 -0
  214. package/dist/workspace/release-steps/doctor.js +14 -0
  215. package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
  216. package/dist/workspace/release-steps/goreleaser.js +36 -0
  217. package/dist/workspace/release-steps/green.d.ts +3 -0
  218. package/dist/workspace/release-steps/green.js +6 -0
  219. package/dist/workspace/release-steps/images.d.ts +22 -0
  220. package/dist/workspace/release-steps/images.js +59 -0
  221. package/dist/workspace/release-steps/index.d.ts +9 -0
  222. package/dist/workspace/release-steps/index.js +50 -0
  223. package/dist/workspace/release-steps/nfpm.d.ts +13 -0
  224. package/dist/workspace/release-steps/nfpm.js +29 -0
  225. package/dist/workspace/release-steps/nuget.d.ts +14 -0
  226. package/dist/workspace/release-steps/nuget.js +16 -0
  227. package/dist/workspace/release-steps/pypi.d.ts +15 -0
  228. package/dist/workspace/release-steps/pypi.js +21 -0
  229. package/dist/workspace/release-steps/qemu.d.ts +21 -0
  230. package/dist/workspace/release-steps/qemu.js +35 -0
  231. package/dist/workspace/release-steps/signing.d.ts +18 -0
  232. package/dist/workspace/release-steps/signing.js +30 -0
  233. package/dist/workspace/release-steps/stamp.d.ts +3 -0
  234. package/dist/workspace/release-steps/stamp.js +4 -0
  235. package/dist/workspace/release-steps/targets.d.ts +31 -0
  236. package/dist/workspace/release-steps/targets.js +40 -0
  237. package/dist/workspace/release-steps/types.d.ts +104 -0
  238. package/dist/workspace/release-steps/types.js +2 -0
  239. package/dist/workspace/release-steps/verify.d.ts +3 -0
  240. package/dist/workspace/release-steps/verify.js +4 -0
  241. package/dist/workspace/release-toolchains.d.ts +59 -0
  242. package/dist/workspace/release-toolchains.js +133 -0
  243. package/dist/workspace/release-train-workflow.d.ts +36 -0
  244. package/dist/workspace/release-train-workflow.js +121 -0
  245. package/dist/workspace/release-train.d.ts +3 -1
  246. package/dist/workspace/release-train.js +20 -3
  247. package/dist/workspace/release-workflow.d.ts +183 -59
  248. package/dist/workspace/release-workflow.js +570 -201
  249. package/dist/workspace/releases.schema.json +70 -1
  250. package/dist/workspace/search-contract.d.ts +1 -1
  251. package/dist/workspace/security.js +9 -2
  252. package/dist/workspace/train-cut.d.ts +182 -0
  253. package/dist/workspace/train-cut.js +504 -0
  254. package/dist/workspace/train-prepare.d.ts +64 -0
  255. package/dist/workspace/train-prepare.js +313 -0
  256. package/dist/workspace/train-publish.d.ts +177 -0
  257. package/dist/workspace/train-publish.js +574 -0
  258. package/dist/workspace/train-range-labels.d.ts +33 -0
  259. package/dist/workspace/train-range-labels.js +109 -0
  260. package/dist/workspace/train-shell.d.ts +5 -0
  261. package/dist/workspace/train-shell.js +17 -0
  262. package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
  263. package/dist/workspace/trust/check-evidence-report.js +3 -7
  264. package/dist/workspace/trust/seal.d.ts +13 -3
  265. package/dist/workspace/trust/seal.js +14 -4
  266. package/dist/workspace/work-cli.d.ts +3 -2
  267. package/dist/workspace/work-cli.js +3 -2
  268. package/dist/workspace/workspace-ledger.d.ts +14 -1
  269. package/dist/workspace/workspace-ledger.js +33 -7
  270. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The green gate of a release cut (#5149): what says a commit may be
3
+ * released, set by `release.green` in the member's `chant.config.ts`.
4
+ *
5
+ * - `chant`: the commit carries a `ci/green/<sha>` tag and no
6
+ * `ci/revoked/<sha>` tag, as `chant ci` writes them from `ci.green`
7
+ * (./release-cut.ts). The default when `chant.workspace.json` declares
8
+ * `ci.green` or the repository holds any `ci/green/` tag.
9
+ * - `forge-checks`: the forge's checks on the commit passed. GitHub: every
10
+ * check run and commit status, and each check a branch rule of the
11
+ * branch requires. Forgejo: every commit status, and each context its
12
+ * branch protection requires when the token can read it. GitLab: the
13
+ * newest pipeline of each source on the commit. A check that failed or has
14
+ * not finished refuses the cut, and so does a commit with no check at all.
15
+ * The release workflow's own runs on the commit are left out (GitHub:
16
+ * every run of the workflow file the cut runs in; Forgejo: the cut's run;
17
+ * GitLab: pipelines started the way the cut's was, from the web or the
18
+ * API). The default otherwise.
19
+ * - `none`: no gate. The cut prints a warning and records that it had none.
20
+ * Refused under the `supply-chain` or `verified-releases` security groups
21
+ * and under a `release` gate in `identity.gates`.
22
+ *
23
+ * The cut records the gate it passed on its cut line (`green`): the tag, the
24
+ * forge and the names of the checks, or `none`. `chant release verify` shows
25
+ * it and the publish's provenance statement carries it.
26
+ *
27
+ * The forge is the CI job's when the cut runs in one (`GITHUB_REPOSITORY`,
28
+ * `CI_PROJECT_ID`, ...), and otherwise the one the checkout's `origin`
29
+ * remote names. The token is read in the order every chant forge client
30
+ * reads it (`FORGE_TOKEN_ORDER`): `CHANT_GITHUB_TOKEN`, `GH_TOKEN`,
31
+ * `GITHUB_TOKEN` on GitHub, and the like on Forgejo and GitLab.
32
+ */
33
+ import type { ForgeFetch, ForgeKind, ForgeTarget } from "../pr-forge.js";
34
+ /** `release.green`. */
35
+ export declare const RELEASE_GREEN_SOURCES: readonly ["chant", "forge-checks", "none"];
36
+ export type ReleaseGreenSource = (typeof RELEASE_GREEN_SOURCES)[number];
37
+ /**
38
+ * The gate a cut checks: `release.green`, else `chant` when the workspace
39
+ * declares `ci.green` or the repository holds `ci/green/` tags (a project
40
+ * that writes them some other way, as before #5149), else `forge-checks`.
41
+ */
42
+ export declare function resolveGreenSource(declared: ReleaseGreenSource | undefined, hasCiGreen: boolean, hasGreenTags?: boolean): ReleaseGreenSource;
43
+ /** One check the forge reports on a commit. */
44
+ export interface ForgeCheck {
45
+ name: string;
46
+ state: "success" | "pending" | "failure";
47
+ /** The forge's own word for it, for a message. */
48
+ status: string;
49
+ url?: string;
50
+ }
51
+ /** What the forge says of a commit's checks. */
52
+ export type ForgeChecksVerdict = {
53
+ green: true;
54
+ forge: ForgeKind;
55
+ checks: string[];
56
+ } | {
57
+ green: false;
58
+ forge: ForgeKind;
59
+ why: string;
60
+ checks: ForgeCheck[];
61
+ };
62
+ /** The forge could not be asked: none is known, a token is missing, or the forge answered with an error. */
63
+ export declare class ForgeChecksUnavailableError extends Error {
64
+ readonly fix?: string | undefined;
65
+ constructor(message: string, fix?: string | undefined);
66
+ }
67
+ /** Reads a commit's checks; a test hands in a fake. */
68
+ export type ForgeChecksReader = (commit: string, branch: string | null) => Promise<ForgeChecksVerdict>;
69
+ /** A check's state from the forge's status and, once completed, conclusion. */
70
+ export declare function checkState(status: string, conclusion?: string | null): ForgeCheck["state"];
71
+ /**
72
+ * The verdict on `checks`: green when there is at least one, each passed,
73
+ * and each of `required` is among them.
74
+ */
75
+ export declare function judgeChecks(forge: ForgeKind, checks: ForgeCheck[], required: readonly string[]): ForgeChecksVerdict;
76
+ /**
77
+ * A reader of the commit checks of the forge `target` names, with `env`
78
+ * naming the run the cut runs in, whose own checks are left out.
79
+ */
80
+ export declare function forgeChecksReader(target: ForgeTarget, env?: Record<string, string | undefined>, fetchImpl?: ForgeFetch): ForgeChecksReader;
81
+ /**
82
+ * The forge a cut in `cwd` asks: the CI job's, read from `env`, or the one
83
+ * the checkout's `origin` remote names, with the token from `env`. Throws
84
+ * {@link ForgeChecksUnavailableError} naming what is missing.
85
+ */
86
+ export declare function forgeChecksTarget(cwd: string, env?: Record<string, string | undefined>): Promise<ForgeTarget>;
@@ -0,0 +1,286 @@
1
+ /**
2
+ * The green gate of a release cut (#5149): what says a commit may be
3
+ * released, set by `release.green` in the member's `chant.config.ts`.
4
+ *
5
+ * - `chant`: the commit carries a `ci/green/<sha>` tag and no
6
+ * `ci/revoked/<sha>` tag, as `chant ci` writes them from `ci.green`
7
+ * (./release-cut.ts). The default when `chant.workspace.json` declares
8
+ * `ci.green` or the repository holds any `ci/green/` tag.
9
+ * - `forge-checks`: the forge's checks on the commit passed. GitHub: every
10
+ * check run and commit status, and each check a branch rule of the
11
+ * branch requires. Forgejo: every commit status, and each context its
12
+ * branch protection requires when the token can read it. GitLab: the
13
+ * newest pipeline of each source on the commit. A check that failed or has
14
+ * not finished refuses the cut, and so does a commit with no check at all.
15
+ * The release workflow's own runs on the commit are left out (GitHub:
16
+ * every run of the workflow file the cut runs in; Forgejo: the cut's run;
17
+ * GitLab: pipelines started the way the cut's was, from the web or the
18
+ * API). The default otherwise.
19
+ * - `none`: no gate. The cut prints a warning and records that it had none.
20
+ * Refused under the `supply-chain` or `verified-releases` security groups
21
+ * and under a `release` gate in `identity.gates`.
22
+ *
23
+ * The cut records the gate it passed on its cut line (`green`): the tag, the
24
+ * forge and the names of the checks, or `none`. `chant release verify` shows
25
+ * it and the publish's provenance statement carries it.
26
+ *
27
+ * The forge is the CI job's when the cut runs in one (`GITHUB_REPOSITORY`,
28
+ * `CI_PROJECT_ID`, ...), and otherwise the one the checkout's `origin`
29
+ * remote names. The token is read in the order every chant forge client
30
+ * reads it (`FORGE_TOKEN_ORDER`): `CHANT_GITHUB_TOKEN`, `GH_TOKEN`,
31
+ * `GITHUB_TOKEN` on GitHub, and the like on Forgejo and GitLab.
32
+ */
33
+ /** `release.green`. */
34
+ export const RELEASE_GREEN_SOURCES = ["chant", "forge-checks", "none"];
35
+ /**
36
+ * The gate a cut checks: `release.green`, else `chant` when the workspace
37
+ * declares `ci.green` or the repository holds `ci/green/` tags (a project
38
+ * that writes them some other way, as before #5149), else `forge-checks`.
39
+ */
40
+ export function resolveGreenSource(declared, hasCiGreen, hasGreenTags = false) {
41
+ return declared ?? (hasCiGreen || hasGreenTags ? "chant" : "forge-checks");
42
+ }
43
+ /** The forge could not be asked: none is known, a token is missing, or the forge answered with an error. */
44
+ export class ForgeChecksUnavailableError extends Error {
45
+ constructor(message, fix) {
46
+ super(message);
47
+ this.fix = fix;
48
+ this.name = "ForgeChecksUnavailableError";
49
+ }
50
+ }
51
+ const PENDING = new Set(["queued", "in_progress", "waiting", "requested", "pending", "running", "created", "preparing", "waiting_for_resource", "scheduled", "manual"]);
52
+ const PASSED = new Set(["success", "neutral", "skipped", "warning"]);
53
+ /** A check's state from the forge's status and, once completed, conclusion. */
54
+ export function checkState(status, conclusion) {
55
+ const s = status.toLowerCase();
56
+ if (PENDING.has(s))
57
+ return "pending";
58
+ const word = (s === "completed" ? (conclusion ?? "") : s).toLowerCase();
59
+ return PASSED.has(word) ? "success" : "failure";
60
+ }
61
+ /**
62
+ * The verdict on `checks`: green when there is at least one, each passed,
63
+ * and each of `required` is among them.
64
+ */
65
+ export function judgeChecks(forge, checks, required) {
66
+ const names = new Set(checks.map((c) => c.name));
67
+ const missing = required.filter((r) => !names.has(r));
68
+ const failed = checks.filter((c) => c.state === "failure");
69
+ const pending = checks.filter((c) => c.state === "pending");
70
+ const list = (cs) => cs.map((c) => `${c.name} (${c.status})`).join(", ");
71
+ if (checks.length === 0)
72
+ return { green: false, forge, checks, why: `${forge} reports no check on it` };
73
+ if (failed.length > 0)
74
+ return { green: false, forge, checks, why: `${failed.length === 1 ? "a check" : `${failed.length} checks`} did not pass on ${forge}: ${list(failed)}` };
75
+ if (pending.length > 0)
76
+ return { green: false, forge, checks, why: `${pending.length === 1 ? "a check has" : `${pending.length} checks have`} not finished on ${forge}: ${list(pending)}` };
77
+ if (missing.length > 0)
78
+ return { green: false, forge, checks, why: `the branch requires ${missing.join(", ")}, which ${forge} does not report on it` };
79
+ return { green: true, forge, checks: [...names].sort() };
80
+ }
81
+ const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
82
+ const str = (v) => (typeof v === "string" ? v : undefined);
83
+ /** Whether `url` is a page of one of the CI runs `runIds` (`.../actions/runs/<id>` or `.../actions/runs/<id>/...`). */
84
+ function inRun(url, runIds) {
85
+ if (!url || !runIds)
86
+ return false;
87
+ const m = /\/actions\/runs\/([0-9A-Za-z]+)(?:\/|$)/.exec(url);
88
+ if (!m)
89
+ return false;
90
+ return typeof runIds === "string" ? m[1] === runIds : runIds.has(m[1]);
91
+ }
92
+ /**
93
+ * A reader of the commit checks of the forge `target` names, with `env`
94
+ * naming the run the cut runs in, whose own checks are left out.
95
+ */
96
+ export function forgeChecksReader(target, env = process.env, fetchImpl) {
97
+ const doFetch = fetchImpl ?? globalThis.fetch;
98
+ const api = target.apiBase.replace(/\/+$/, "");
99
+ const headers = target.kind === "gitlab"
100
+ ? { [target.tokenHeader ?? "PRIVATE-TOKEN"]: target.token, Accept: "application/json" }
101
+ : target.kind === "github"
102
+ ? { Authorization: `Bearer ${target.token}`, Accept: "application/vnd.github+json" }
103
+ : { Authorization: `token ${target.token}`, Accept: "application/json" };
104
+ /** GET a JSON document; `optional` answers undefined for a refusal or a missing resource rather than throwing. */
105
+ const get = async (path, optional = false) => {
106
+ const url = `${api}${path}`;
107
+ let res;
108
+ try {
109
+ res = await doFetch(url, { method: "GET", headers });
110
+ }
111
+ catch (err) {
112
+ throw new ForgeChecksUnavailableError(`${target.kind} could not be reached at ${api}: ${err instanceof Error ? err.message : String(err)}`);
113
+ }
114
+ if (!res.ok) {
115
+ if (optional && [401, 403, 404].includes(res.status))
116
+ return undefined;
117
+ throw new ForgeChecksUnavailableError(`${target.kind} answered ${res.status} to GET ${path}`, res.status === 401 || res.status === 403 || res.status === 404
118
+ ? `The token from ${target.tokenSource} must read the repository's checks and statuses (GitHub: checks: read and statuses: read).`
119
+ : undefined);
120
+ }
121
+ try {
122
+ return JSON.parse(await res.text());
123
+ }
124
+ catch {
125
+ throw new ForgeChecksUnavailableError(`${target.kind} answered GET ${path} with something that is not JSON`);
126
+ }
127
+ };
128
+ if (target.kind === "github") {
129
+ const repo = `/repos/${target.repo}`;
130
+ // The release workflow's own runs on the commit, this one and any earlier attempt, are not checks of it.
131
+ const workflowPath = env.GITHUB_WORKFLOW_REF ? /^[^/]+\/[^/]+\/(.+?)@/.exec(env.GITHUB_WORKFLOW_REF)?.[1] : undefined;
132
+ return async (sha, branch) => {
133
+ const runId = new Set(env.GITHUB_RUN_ID ? [env.GITHUB_RUN_ID] : []);
134
+ if (workflowPath) {
135
+ const runs = await get(`${repo}/actions/runs?head_sha=${sha}&per_page=100`, true);
136
+ for (const r of isObject(runs) && Array.isArray(runs.workflow_runs) ? runs.workflow_runs.filter(isObject) : []) {
137
+ if (str(r.path) === workflowPath && r.id !== undefined)
138
+ runId.add(String(r.id));
139
+ }
140
+ }
141
+ const checks = [];
142
+ for (let page = 1; page <= 20; page++) {
143
+ const got = await get(`${repo}/commits/${sha}/check-runs?per_page=100&page=${page}`);
144
+ const runs = isObject(got) && Array.isArray(got.check_runs) ? got.check_runs.filter(isObject) : [];
145
+ for (const r of runs) {
146
+ const name = str(r.name);
147
+ const url = str(r.details_url) ?? str(r.html_url);
148
+ if (!name || inRun(url, runId))
149
+ continue;
150
+ const status = str(r.status) ?? "unknown";
151
+ const conclusion = str(r.conclusion) ?? null;
152
+ checks.push({ name, state: checkState(status, conclusion), status: status === "completed" ? (conclusion ?? status) : status, ...(url ? { url } : {}) });
153
+ }
154
+ if (runs.length < 100)
155
+ break;
156
+ }
157
+ const combined = await get(`${repo}/commits/${sha}/status?per_page=100`);
158
+ for (const s of isObject(combined) && Array.isArray(combined.statuses) ? combined.statuses.filter(isObject) : []) {
159
+ const name = str(s.context);
160
+ const url = str(s.target_url);
161
+ if (!name || inRun(url, runId))
162
+ continue;
163
+ const state = str(s.state) ?? "unknown";
164
+ checks.push({ name, state: state === "error" ? "failure" : checkState(state), status: state, ...(url ? { url } : {}) });
165
+ }
166
+ const required = [];
167
+ if (branch) {
168
+ const rules = await get(`${repo}/rules/branches/${encodeURIComponent(branch)}`, true);
169
+ for (const rule of Array.isArray(rules) ? rules.filter(isObject) : []) {
170
+ if (rule.type !== "required_status_checks" || !isObject(rule.parameters))
171
+ continue;
172
+ const list = rule.parameters.required_status_checks;
173
+ for (const c of Array.isArray(list) ? list.filter(isObject) : []) {
174
+ const ctx = str(c.context);
175
+ if (ctx && !required.includes(ctx))
176
+ required.push(ctx);
177
+ }
178
+ }
179
+ }
180
+ return judgeChecks("github", newestByName(checks), required);
181
+ };
182
+ }
183
+ if (target.kind === "forgejo") {
184
+ const runNumber = env.FORGEJO_RUN_NUMBER ?? env.GITHUB_RUN_NUMBER;
185
+ const repo = `/repos/${target.repo}`;
186
+ return async (sha, branch) => {
187
+ const combined = await get(`${repo}/commits/${sha}/status?limit=100`);
188
+ const checks = [];
189
+ for (const s of isObject(combined) && Array.isArray(combined.statuses) ? combined.statuses.filter(isObject) : []) {
190
+ const name = str(s.context);
191
+ const url = str(s.target_url);
192
+ if (!name || inRun(url, runNumber))
193
+ continue;
194
+ const state = str(s.status) ?? str(s.state) ?? "unknown";
195
+ checks.push({ name, state: state === "error" ? "failure" : checkState(state), status: state, ...(url ? { url } : {}) });
196
+ }
197
+ const required = [];
198
+ if (branch) {
199
+ const protections = await get(`${repo}/branch_protections`, true);
200
+ for (const p of Array.isArray(protections) ? protections.filter(isObject) : []) {
201
+ const names = [str(p.rule_name), str(p.branch_name)];
202
+ if (!names.includes(branch) || p.enable_status_check !== true)
203
+ continue;
204
+ for (const ctx of Array.isArray(p.status_check_contexts) ? p.status_check_contexts : [])
205
+ if (typeof ctx === "string" && !required.includes(ctx))
206
+ required.push(ctx);
207
+ }
208
+ }
209
+ return judgeChecks("forgejo", newestByName(checks), required);
210
+ };
211
+ }
212
+ const pipelineId = env.CI_PIPELINE_ID;
213
+ // A release started from "Run pipeline" or the API is such a pipeline itself, as are earlier attempts of it.
214
+ const ownSource = ["web", "api", "trigger"].includes(env.CI_PIPELINE_SOURCE ?? "") ? env.CI_PIPELINE_SOURCE : undefined;
215
+ const project = `/projects/${encodeURIComponent(target.repo)}`;
216
+ return async (sha) => {
217
+ const got = await get(`${project}/pipelines?sha=${encodeURIComponent(sha)}&per_page=100&order_by=id&sort=desc`);
218
+ const checks = [];
219
+ const seen = new Set();
220
+ for (const p of Array.isArray(got) ? got.filter(isObject) : []) {
221
+ const id = p.id;
222
+ if (id === undefined || String(id) === pipelineId || (ownSource !== undefined && p.source === ownSource))
223
+ continue;
224
+ // The newest pipeline of each source (push, merge_request_event, schedule, ...) speaks for it.
225
+ const name = `pipeline (${str(p.source) ?? "unknown"})`;
226
+ if (seen.has(name))
227
+ continue;
228
+ seen.add(name);
229
+ const status = str(p.status) ?? "unknown";
230
+ const url = str(p.web_url);
231
+ checks.push({ name, state: status === "canceled" ? "failure" : checkState(status), status, ...(url ? { url } : {}) });
232
+ }
233
+ return judgeChecks("gitlab", checks, []);
234
+ };
235
+ }
236
+ /** Each check name once, at the worst state any entry of that name has, so a check run and a status of the same name can't hide a failure. */
237
+ function newestByName(checks) {
238
+ const rank = { failure: 2, pending: 1, success: 0 };
239
+ const out = new Map();
240
+ for (const c of checks) {
241
+ const had = out.get(c.name);
242
+ if (!had || rank[c.state] > rank[had.state])
243
+ out.set(c.name, c);
244
+ }
245
+ return [...out.values()].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
246
+ }
247
+ /**
248
+ * The forge a cut in `cwd` asks: the CI job's, read from `env`, or the one
249
+ * the checkout's `origin` remote names, with the token from `env`. Throws
250
+ * {@link ForgeChecksUnavailableError} naming what is missing.
251
+ */
252
+ export async function forgeChecksTarget(cwd, env = process.env) {
253
+ const { detectForge, forgeTargetFromEnv, ForgeEnvironmentError, FORGE_TOKEN_ORDER } = await import("../pr-forge.js");
254
+ const inCi = detectForge(env);
255
+ if (inCi) {
256
+ try {
257
+ return forgeTargetFromEnv(env, { kind: inCi });
258
+ }
259
+ catch (err) {
260
+ if (err instanceof ForgeEnvironmentError) {
261
+ throw new ForgeChecksUnavailableError(`release.green is forge-checks, and this ${inCi} job can't ask ${inCi} for the commit's checks: it needs ${err.missing.join(", ")}`, inCi === "github" ? "Give the job its token (env GITHUB_TOKEN: ${{ github.token }}) with checks: read and statuses: read." : `Set ${FORGE_TOKEN_ORDER[inCi][0]} to a token that reads the repository's pipelines and statuses.`);
262
+ }
263
+ throw err;
264
+ }
265
+ }
266
+ const { forgeOfCheckout } = await import("../forge-remote.js");
267
+ const remote = forgeOfCheckout(cwd);
268
+ if (!remote) {
269
+ throw new ForgeChecksUnavailableError("release.green is forge-checks, and the origin remote names no forge chant reads checks from (GitHub, GitLab or Forgejo)", 'Cut from a checkout whose origin is on GitHub, GitLab or Forgejo, or set release.green in chant.config.ts to "chant" (ci/green tags) or "none".');
270
+ }
271
+ const names = FORGE_TOKEN_ORDER[remote.kind];
272
+ const tokenSource = names.find((n) => env[n]?.trim());
273
+ if (!tokenSource) {
274
+ throw new ForgeChecksUnavailableError(`release.green is forge-checks, and no token to ask ${remote.kind} (${remote.host}) for the commit's checks is set: ${names.join(", ")}`, remote.kind === "github" ? "Set GH_TOKEN, for one: GH_TOKEN=$(gh auth token) chant release cut ..." : `Set ${names[0]} to a token that reads ${remote.repo}.`);
275
+ }
276
+ const apiBase = remote.kind === "github" ? (remote.host === "github.com" ? "https://api.github.com" : `${remote.url}/api/v3`) : remote.kind === "gitlab" ? `${remote.url}/api/v4` : `${remote.url}/api/v1`;
277
+ return {
278
+ kind: remote.kind,
279
+ apiBase,
280
+ repo: remote.repo,
281
+ host: remote.host,
282
+ token: env[tokenSource].trim(),
283
+ tokenSource,
284
+ ...(remote.kind === "gitlab" ? { tokenHeader: "PRIVATE-TOKEN" } : {}),
285
+ };
286
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * What `chant release init` finds and plans for Maven, .NET and Ruby
3
+ * projects (#5232): a `pom.xml`, `*.csproj` files or a `*.gemspec` at the
4
+ * project's root, built once at the cut by a `release.artifacts` entry and
5
+ * published by a `maven`, `nuget` or `rubygems` target.
6
+ */
7
+ type Json = string | number | boolean | null | Json[] | {
8
+ [k: string]: Json;
9
+ };
10
+ /** What {@link detectRegistryProjects} found. */
11
+ export interface RegistryProjectFacts {
12
+ maven: {
13
+ groupId: string | null;
14
+ artifactId: string | null;
15
+ } | null;
16
+ /** The `.csproj` files at the root that pack, with their package ids. */
17
+ dotnet: {
18
+ projects: Array<{
19
+ file: string;
20
+ id: string;
21
+ }>;
22
+ } | null;
23
+ ruby: {
24
+ gemspec: string;
25
+ name: string;
26
+ } | null;
27
+ }
28
+ /** The project's own `groupId` and `artifactId` in a `pom.xml`, its parent's `groupId` when it has none. */
29
+ export declare function pomFacts(text: string): NonNullable<RegistryProjectFacts["maven"]>;
30
+ /** The Maven, .NET and Ruby projects at `root`. */
31
+ export declare function detectRegistryProjects(root: string): RegistryProjectFacts;
32
+ /** What the plan adds for these projects. */
33
+ export interface RegistryPlan {
34
+ artifacts: Json[];
35
+ publish: Json[];
36
+ reasons: string[];
37
+ notes: string[];
38
+ registry: string[];
39
+ /** Variables for `release.workflow.env`, on GitHub and Forgejo. */
40
+ env: Record<string, string>;
41
+ }
42
+ /** The artifacts, targets and steps for the Maven, .NET and Ruby projects found. */
43
+ export declare function planRegistryTargets(facts: RegistryProjectFacts, o: {
44
+ forge: "github" | "gitlab" | "forgejo";
45
+ repo: string;
46
+ workflowName: string;
47
+ }): RegistryPlan;
48
+ export {};
@@ -0,0 +1,97 @@
1
+ /**
2
+ * What `chant release init` finds and plans for Maven, .NET and Ruby
3
+ * projects (#5232): a `pom.xml`, `*.csproj` files or a `*.gemspec` at the
4
+ * project's root, built once at the cut by a `release.artifacts` entry and
5
+ * published by a `maven`, `nuget` or `rubygems` target.
6
+ */
7
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ const read = (p) => {
10
+ try {
11
+ return readFileSync(p, "utf-8");
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ };
17
+ /** The project's own `groupId` and `artifactId` in a `pom.xml`, its parent's `groupId` when it has none. */
18
+ export function pomFacts(text) {
19
+ const body = text.replace(/<!--[\s\S]*?-->/g, "");
20
+ const top = body.replace(/<parent>[\s\S]*?<\/parent>/, "").replace(/<(dependencies|dependencyManagement|build|profiles|plugins|modules)>[\s\S]*?<\/\1>/g, "");
21
+ const get = (s, tag) => new RegExp(`<${tag}>\\s*([^<]+?)\\s*</${tag}>`).exec(s)?.[1] ?? null;
22
+ const parent = /<parent>([\s\S]*?)<\/parent>/.exec(body)?.[1] ?? "";
23
+ return { groupId: get(top, "groupId") ?? get(parent, "groupId"), artifactId: get(top, "artifactId") };
24
+ }
25
+ /** The Maven, .NET and Ruby projects at `root`. */
26
+ export function detectRegistryProjects(root) {
27
+ const pom = read(join(root, "pom.xml"));
28
+ const files = existsSync(root) ? readdirSync(root).sort() : [];
29
+ const projects = files
30
+ .filter((f) => f.endsWith(".csproj"))
31
+ .map((file) => ({ file, text: read(join(root, file)) ?? "" }))
32
+ .filter((p) => !/<IsPackable>\s*false\s*<\/IsPackable>/i.test(p.text))
33
+ .map((p) => ({ file: p.file, id: /<PackageId>\s*([^<]+?)\s*<\/PackageId>/.exec(p.text)?.[1] ?? p.file.slice(0, -".csproj".length) }));
34
+ const gemspec = files.find((f) => f.endsWith(".gemspec"));
35
+ const gemName = gemspec ? (/\.name\s*=\s*["']([^"']+)["']/.exec(read(join(root, gemspec)) ?? "")?.[1] ?? gemspec.slice(0, -".gemspec".length)) : null;
36
+ return {
37
+ maven: pom === null ? null : pomFacts(pom),
38
+ dotnet: projects.length > 0 ? { projects } : null,
39
+ ruby: gemspec && gemName ? { gemspec, name: gemName } : null,
40
+ };
41
+ }
42
+ /** The artifacts, targets and steps for the Maven, .NET and Ruby projects found. */
43
+ export function planRegistryTargets(facts, o) {
44
+ const plan = { artifacts: [], publish: [], reasons: [], notes: [], registry: [], env: {} };
45
+ const secret = (name) => {
46
+ if (o.forge !== "gitlab")
47
+ plan.env[name] = `\${{ secrets.${name} }}`;
48
+ };
49
+ const store = o.forge === "gitlab" ? "masked CI/CD variable" : "secret";
50
+ const trusted = o.forge === "gitlab" ? `GitLab CI/CD naming ${o.repo} and the top-level pipeline file .gitlab-ci.yml` : `GitHub Actions naming ${o.repo} and the workflow file ${o.workflowName}`;
51
+ const mv = facts.maven;
52
+ if (mv) {
53
+ const coord = mv.groupId && mv.artifactId ? `${mv.groupId}:${mv.artifactId}` : "the project";
54
+ plan.artifacts.push({ name: "maven", build: "mvn -B -ntp deploy -DaltDeploymentRepository=local::file:./target/staging-deploy && cd target/staging-deploy && zip -qr ../central-bundle.zip .", outputs: ["target/central-bundle.zip"] });
55
+ plan.publish.push({ type: "maven", bundle: "artifact:maven" });
56
+ plan.reasons.push(`release.artifacts: ${coord} is deployed once at the cut into target/staging-deploy, zipped as a Central Portal bundle that the release records`);
57
+ plan.reasons.push(`maven target: the bundle, uploaded to the Central Portal and validated at the stage, published to Maven Central at the reveal`);
58
+ plan.notes.push("pom.xml's version is published as written: set it to the release's label before the cut, or use ${revision} and pass -Drevision=\"$CHANT_RELEASE_LABEL\" in the build. Maven Central takes only signed files: the build must sign them, such as with maven-gpg-plugin.");
59
+ secret("MAVEN_CENTRAL_USERNAME");
60
+ secret("MAVEN_CENTRAL_PASSWORD");
61
+ plan.registry.push(`Maven Central ${coord}: verify the namespace ${mv.groupId ?? "<groupId>"} at https://central.sonatype.com, generate a user token, and store its name and password as the ${store}s MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD. Give the cut job the GPG key the build signs with, and publish the key's public half to a keyserver.`);
62
+ }
63
+ const dn = facts.dotnet;
64
+ if (dn) {
65
+ const ids = dn.projects.map((p) => p.id).join(", ");
66
+ const pack = dn.projects.map((p) => `dotnet pack ${p.file} -c Release -o dist/nuget -p:Version="$CHANT_RELEASE_LABEL"`).join(" && ");
67
+ plan.artifacts.push({ name: "nuget", build: pack, outputs: ["dist/nuget/*.nupkg"] });
68
+ const tp = o.forge !== "forgejo";
69
+ plan.publish.push({ type: "nuget", packages: ["artifact:nuget"], auth: tp ? "trusted-publishing" : "token" });
70
+ plan.reasons.push(`release.artifacts: ${ids} packed once at the cut with dotnet pack, at the release's label, and the release records each .nupkg`);
71
+ plan.reasons.push(`nuget target: the recorded packages, pushed to nuget.org ${tp ? "with trusted publishing" : "with the API key in NUGET_API_KEY"}`);
72
+ if (tp) {
73
+ secret("NUGET_USER");
74
+ plan.registry.push(`nuget.org ${ids}: add a trusted publishing policy for ${trusted}, and store the nuget.org profile name of the user who created it (not the email address) as the ${store} NUGET_USER.`);
75
+ }
76
+ else {
77
+ secret("NUGET_API_KEY");
78
+ plan.registry.push(`nuget.org ${ids}: create an API key that may push ${dn.projects.length === 1 ? "the package" : "the packages"} and store it as the secret NUGET_API_KEY; nuget.org has no trusted publishing for this forge.`);
79
+ }
80
+ }
81
+ const rb = facts.ruby;
82
+ if (rb) {
83
+ plan.artifacts.push({ name: "gem", build: `gem build ${rb.gemspec} && mkdir -p dist/gem && mv ${rb.name}-*.gem dist/gem/`, outputs: ["dist/gem/*.gem"] });
84
+ const tp = o.forge === "github";
85
+ plan.publish.push({ type: "rubygems", gems: ["artifact:gem"], auth: tp ? "trusted-publishing" : "token" });
86
+ plan.reasons.push(`release.artifacts: ${rb.name} is built once at the cut with gem build, and the release records the .gem`);
87
+ plan.reasons.push(`rubygems target: the recorded gem, pushed to RubyGems.org ${tp ? "with trusted publishing" : "with the API key in GEM_HOST_API_KEY"}`);
88
+ plan.notes.push(`${rb.gemspec}'s version is published as the gemspec sets it: set it to the release's label before the cut, or read it from CHANT_RELEASE_LABEL in the gemspec.`);
89
+ if (tp)
90
+ plan.registry.push(`RubyGems.org ${rb.name}: add a trusted publisher for GitHub Actions naming ${o.repo} and the workflow file ${o.workflowName} (a pending trusted publisher if the gem does not exist yet).`);
91
+ else {
92
+ secret("GEM_HOST_API_KEY");
93
+ plan.registry.push(`RubyGems.org ${rb.name}: create an API key with the push scope and store it as the ${store} GEM_HOST_API_KEY; RubyGems.org has no trusted publishing for this forge.`);
94
+ }
95
+ }
96
+ return plan;
97
+ }