@intentius/chant 0.124.100 → 0.124.101

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 (223) 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-system.d.ts +66 -0
  6. package/dist/ci-system.js +61 -0
  7. package/dist/cli/handlers/build.js +27 -0
  8. package/dist/cli/handlers/release-doctor.d.ts +12 -0
  9. package/dist/cli/handlers/release-doctor.js +118 -0
  10. package/dist/cli/handlers/release-init.d.ts +10 -0
  11. package/dist/cli/handlers/release-init.js +342 -0
  12. package/dist/cli/handlers/release.d.ts +42 -1
  13. package/dist/cli/handlers/release.js +656 -31
  14. package/dist/cli/handlers/run-generate.js +11 -0
  15. package/dist/cli/main.d.ts +2 -0
  16. package/dist/cli/main.js +44 -101
  17. package/dist/cli/parse-args.js +48 -0
  18. package/dist/cli/registry.d.ts +16 -0
  19. package/dist/cli/release-commands/artifacts.d.ts +3 -0
  20. package/dist/cli/release-commands/artifacts.js +14 -0
  21. package/dist/cli/release-commands/candidates.d.ts +3 -0
  22. package/dist/cli/release-commands/candidates.js +16 -0
  23. package/dist/cli/release-commands/changed.d.ts +3 -0
  24. package/dist/cli/release-commands/changed.js +14 -0
  25. package/dist/cli/release-commands/compose.d.ts +3 -0
  26. package/dist/cli/release-commands/compose.js +16 -0
  27. package/dist/cli/release-commands/cut.d.ts +3 -0
  28. package/dist/cli/release-commands/cut.js +49 -0
  29. package/dist/cli/release-commands/doctor.d.ts +3 -0
  30. package/dist/cli/release-commands/doctor.js +14 -0
  31. package/dist/cli/release-commands/export.d.ts +3 -0
  32. package/dist/cli/release-commands/export.js +12 -0
  33. package/dist/cli/release-commands/images.d.ts +3 -0
  34. package/dist/cli/release-commands/images.js +13 -0
  35. package/dist/cli/release-commands/index.d.ts +8 -0
  36. package/dist/cli/release-commands/index.js +52 -0
  37. package/dist/cli/release-commands/init.d.ts +3 -0
  38. package/dist/cli/release-commands/init.js +16 -0
  39. package/dist/cli/release-commands/list.d.ts +3 -0
  40. package/dist/cli/release-commands/list.js +10 -0
  41. package/dist/cli/release-commands/next.d.ts +3 -0
  42. package/dist/cli/release-commands/next.js +13 -0
  43. package/dist/cli/release-commands/publish.d.ts +3 -0
  44. package/dist/cli/release-commands/publish.js +22 -0
  45. package/dist/cli/release-commands/stamp.d.ts +3 -0
  46. package/dist/cli/release-commands/stamp.js +15 -0
  47. package/dist/cli/release-commands/status.d.ts +3 -0
  48. package/dist/cli/release-commands/status.js +17 -0
  49. package/dist/cli/release-commands/tag.d.ts +3 -0
  50. package/dist/cli/release-commands/tag.js +12 -0
  51. package/dist/cli/release-commands/types.d.ts +20 -0
  52. package/dist/cli/release-commands/types.js +1 -0
  53. package/dist/cli/release-commands/verify.d.ts +3 -0
  54. package/dist/cli/release-commands/verify.js +15 -0
  55. package/dist/cli/release-commands/workflow.d.ts +3 -0
  56. package/dist/cli/release-commands/workflow.js +13 -0
  57. package/dist/components/cli-support.d.ts +1 -1
  58. package/dist/components/cli-support.js +1 -1
  59. package/dist/config-environments.d.ts +8 -1
  60. package/dist/config-environments.js +2 -0
  61. package/dist/config.d.ts +294 -9
  62. package/dist/config.js +100 -5
  63. package/dist/floor-table.data.js +15 -1
  64. package/dist/forge-remote.d.ts +13 -0
  65. package/dist/forge-remote.js +15 -0
  66. package/dist/lexicon.d.ts +41 -2
  67. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
  68. package/dist/lifecycle/__fixtures__/publish-fakes.js +270 -3
  69. package/dist/lifecycle/publish-attachments.d.ts +2 -1
  70. package/dist/lifecycle/publish-attachments.js +19 -2
  71. package/dist/lifecycle/publish-cargo.d.ts +99 -0
  72. package/dist/lifecycle/publish-cargo.js +412 -0
  73. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  74. package/dist/lifecycle/publish-credentials.js +8 -0
  75. package/dist/lifecycle/publish-declaration.d.ts +199 -4
  76. package/dist/lifecycle/publish-declaration.js +200 -9
  77. package/dist/lifecycle/publish-forge.d.ts +45 -2
  78. package/dist/lifecycle/publish-forge.js +434 -34
  79. package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
  80. package/dist/lifecycle/publish-git-ssh.js +30 -4
  81. package/dist/lifecycle/publish-github.d.ts +40 -2
  82. package/dist/lifecycle/publish-github.js +100 -3
  83. package/dist/lifecycle/publish-homebrew.d.ts +7 -9
  84. package/dist/lifecycle/publish-homebrew.js +34 -197
  85. package/dist/lifecycle/publish-index.d.ts +141 -0
  86. package/dist/lifecycle/publish-index.js +719 -0
  87. package/dist/lifecycle/publish-marketplace.js +77 -0
  88. package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
  89. package/dist/lifecycle/publish-mcp-registry.js +306 -0
  90. package/dist/lifecycle/publish-npm.js +165 -2
  91. package/dist/lifecycle/publish-oci.d.ts +34 -1
  92. package/dist/lifecycle/publish-oci.js +246 -7
  93. package/dist/lifecycle/publish-pypi.d.ts +136 -0
  94. package/dist/lifecycle/publish-pypi.js +657 -0
  95. package/dist/lifecycle/publish-record.d.ts +6 -3
  96. package/dist/lifecycle/publish-record.js +6 -3
  97. package/dist/lifecycle/publish-signing.d.ts +147 -0
  98. package/dist/lifecycle/publish-signing.js +257 -0
  99. package/dist/lifecycle/publish-targets.d.ts +27 -1
  100. package/dist/lifecycle/publish-targets.js +80 -0
  101. package/dist/lifecycle/publish-tauri.js +43 -0
  102. package/dist/lifecycle/publish-train-names.d.ts +54 -0
  103. package/dist/lifecycle/publish-train-names.js +118 -0
  104. package/dist/lifecycle/publish-verify.d.ts +121 -0
  105. package/dist/lifecycle/publish-verify.js +130 -0
  106. package/dist/lifecycle/query.js +8 -0
  107. package/dist/lifecycle/release-artifacts.d.ts +212 -0
  108. package/dist/lifecycle/release-artifacts.js +571 -0
  109. package/dist/lifecycle/release-changelog.d.ts +13 -1
  110. package/dist/lifecycle/release-changelog.js +35 -2
  111. package/dist/lifecycle/release-cut.d.ts +58 -3
  112. package/dist/lifecycle/release-cut.js +132 -34
  113. package/dist/lifecycle/release-doctor.d.ts +113 -0
  114. package/dist/lifecycle/release-doctor.js +996 -0
  115. package/dist/lifecycle/release-green.d.ts +86 -0
  116. package/dist/lifecycle/release-green.js +286 -0
  117. package/dist/lifecycle/release-init.d.ts +255 -0
  118. package/dist/lifecycle/release-init.js +859 -0
  119. package/dist/lifecycle/release-intents.d.ts +73 -0
  120. package/dist/lifecycle/release-intents.js +128 -0
  121. package/dist/lifecycle/release-next.d.ts +111 -0
  122. package/dist/lifecycle/release-next.js +252 -0
  123. package/dist/lifecycle/release-prerelease.d.ts +19 -0
  124. package/dist/lifecycle/release-prerelease.js +30 -0
  125. package/dist/lifecycle/release-publish.d.ts +256 -10
  126. package/dist/lifecycle/release-publish.js +246 -34
  127. package/dist/lifecycle/release-status-change.d.ts +226 -0
  128. package/dist/lifecycle/release-status-change.js +478 -0
  129. package/dist/lifecycle/release-status.d.ts +11 -0
  130. package/dist/lifecycle/release-status.js +1 -1
  131. package/dist/lifecycle/release-store.d.ts +73 -2
  132. package/dist/lifecycle/release-store.js +32 -1
  133. package/dist/lifecycle/release-tag.d.ts +142 -0
  134. package/dist/lifecycle/release-tag.js +323 -0
  135. package/dist/lifecycle/release-verify.d.ts +73 -1
  136. package/dist/lifecycle/release-verify.js +117 -2
  137. package/dist/lifecycle/release-version-formats.d.ts +73 -0
  138. package/dist/lifecycle/release-version-formats.js +570 -0
  139. package/dist/lifecycle/release-version.d.ts +58 -10
  140. package/dist/lifecycle/release-version.js +164 -36
  141. package/dist/lifecycle/release-workstation.d.ts +3 -2
  142. package/dist/lifecycle/release-workstation.js +3 -2
  143. package/dist/op/generate-pipeline.js +1 -1
  144. package/dist/pr-forge-base.js +4 -2
  145. package/dist/pr-forge.d.ts +20 -2
  146. package/dist/pr-forge.js +46 -10
  147. package/dist/release-floors.d.ts +8 -1
  148. package/dist/release-floors.js +9 -2
  149. package/dist/tool-pins.d.ts +38 -0
  150. package/dist/tool-pins.js +54 -0
  151. package/dist/wave-runtime.mjs +337 -334
  152. package/dist/workspace/ci-forge.d.ts +17 -0
  153. package/dist/workspace/ci-forge.js +17 -0
  154. package/dist/workspace/ci-init.js +1 -1
  155. package/dist/workspace/composites.schema.json +1 -0
  156. package/dist/workspace/declaration.d.ts +8 -0
  157. package/dist/workspace/declaration.js +12 -0
  158. package/dist/workspace/declaration.schema.json +8 -0
  159. package/dist/workspace/environments.d.ts +2 -0
  160. package/dist/workspace/environments.js +1 -1
  161. package/dist/workspace/identity-gate-rule.d.ts +61 -5
  162. package/dist/workspace/identity-gate-rule.js +81 -12
  163. package/dist/workspace/member-pipeline.d.ts +2 -1
  164. package/dist/workspace/member-pipeline.js +5 -2
  165. package/dist/workspace/reason-codes.d.ts +2 -0
  166. package/dist/workspace/reason-codes.js +3 -1
  167. package/dist/workspace/release-changed.d.ts +75 -4
  168. package/dist/workspace/release-changed.js +205 -34
  169. package/dist/workspace/release-changed.schema.json +20 -2
  170. package/dist/workspace/release-steps/artifacts.d.ts +7 -0
  171. package/dist/workspace/release-steps/artifacts.js +45 -0
  172. package/dist/workspace/release-steps/builds.d.ts +12 -0
  173. package/dist/workspace/release-steps/builds.js +38 -0
  174. package/dist/workspace/release-steps/doctor.d.ts +8 -0
  175. package/dist/workspace/release-steps/doctor.js +14 -0
  176. package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
  177. package/dist/workspace/release-steps/goreleaser.js +36 -0
  178. package/dist/workspace/release-steps/green.d.ts +3 -0
  179. package/dist/workspace/release-steps/green.js +6 -0
  180. package/dist/workspace/release-steps/images.d.ts +22 -0
  181. package/dist/workspace/release-steps/images.js +59 -0
  182. package/dist/workspace/release-steps/index.d.ts +9 -0
  183. package/dist/workspace/release-steps/index.js +46 -0
  184. package/dist/workspace/release-steps/pypi.d.ts +15 -0
  185. package/dist/workspace/release-steps/pypi.js +21 -0
  186. package/dist/workspace/release-steps/qemu.d.ts +21 -0
  187. package/dist/workspace/release-steps/qemu.js +35 -0
  188. package/dist/workspace/release-steps/signing.d.ts +18 -0
  189. package/dist/workspace/release-steps/signing.js +30 -0
  190. package/dist/workspace/release-steps/stamp.d.ts +3 -0
  191. package/dist/workspace/release-steps/stamp.js +4 -0
  192. package/dist/workspace/release-steps/targets.d.ts +31 -0
  193. package/dist/workspace/release-steps/targets.js +40 -0
  194. package/dist/workspace/release-steps/types.d.ts +104 -0
  195. package/dist/workspace/release-steps/types.js +2 -0
  196. package/dist/workspace/release-steps/verify.d.ts +3 -0
  197. package/dist/workspace/release-steps/verify.js +4 -0
  198. package/dist/workspace/release-toolchains.d.ts +59 -0
  199. package/dist/workspace/release-toolchains.js +133 -0
  200. package/dist/workspace/release-train-workflow.d.ts +29 -0
  201. package/dist/workspace/release-train-workflow.js +85 -0
  202. package/dist/workspace/release-train.d.ts +3 -1
  203. package/dist/workspace/release-train.js +20 -3
  204. package/dist/workspace/release-workflow.d.ts +160 -61
  205. package/dist/workspace/release-workflow.js +539 -193
  206. package/dist/workspace/releases.schema.json +70 -1
  207. package/dist/workspace/search-contract.d.ts +1 -1
  208. package/dist/workspace/security.js +9 -2
  209. package/dist/workspace/train-cut.d.ts +182 -0
  210. package/dist/workspace/train-cut.js +482 -0
  211. package/dist/workspace/train-prepare.d.ts +61 -0
  212. package/dist/workspace/train-prepare.js +267 -0
  213. package/dist/workspace/train-publish.d.ts +177 -0
  214. package/dist/workspace/train-publish.js +575 -0
  215. package/dist/workspace/train-range-labels.d.ts +33 -0
  216. package/dist/workspace/train-range-labels.js +109 -0
  217. package/dist/workspace/trust/seal.d.ts +13 -3
  218. package/dist/workspace/trust/seal.js +14 -4
  219. package/dist/workspace/work-cli.d.ts +3 -2
  220. package/dist/workspace/work-cli.js +3 -2
  221. package/dist/workspace/workspace-ledger.d.ts +14 -1
  222. package/dist/workspace/workspace-ledger.js +33 -7
  223. package/package.json +1 -1
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The toolchains a generated release workflow sets up (#5152), and the
3
+ * per-platform build jobs that run before the cut.
4
+ *
5
+ * A job that runs chant always has Node, since chant runs on it. Beside it
6
+ * the jobs set up what the project builds with: declared in
7
+ * `release.workflow.toolchains`, or found from the files at the project's
8
+ * root (`go.mod`, `pyproject.toml`, `Cargo.toml`, `pom.xml`, ...). Each
9
+ * setup action is pinned by commit in ../action-pins.ts, and none caches:
10
+ * a release build starts from the commit and the toolchain, not from a cache
11
+ * an earlier run could have written.
12
+ */
13
+ import { ACTION_PINS, usesRef } from "../action-pins.js";
14
+ export const RELEASE_TOOLCHAINS = ["node", "go", "python", "rust", "java"];
15
+ /** The files at a project's root that say which toolchain it builds with, and which version. */
16
+ export const TOOLCHAIN_MARKERS = [
17
+ "package.json",
18
+ "go.mod",
19
+ "pyproject.toml",
20
+ "setup.py",
21
+ "requirements.txt",
22
+ ".python-version",
23
+ "Cargo.toml",
24
+ "pom.xml",
25
+ "build.gradle",
26
+ "build.gradle.kts",
27
+ ".java-version",
28
+ ".sdkmanrc",
29
+ ".tool-versions",
30
+ ];
31
+ const FOUND_BY = {
32
+ node: ["package.json"],
33
+ go: ["go.mod"],
34
+ python: ["pyproject.toml", "setup.py", "requirements.txt"],
35
+ rust: ["Cargo.toml"],
36
+ java: ["pom.xml", "build.gradle", "build.gradle.kts"],
37
+ };
38
+ /** The toolchains the files at a project's root name, in {@link RELEASE_TOOLCHAINS} order. */
39
+ export function detectToolchains(files) {
40
+ return RELEASE_TOOLCHAINS.filter((t) => FOUND_BY[t].some((f) => files.has(f)));
41
+ }
42
+ /** The Node every job that runs chant gets, as the workflow always set it up. */
43
+ export const NODE_DEFAULT_VERSION = 24;
44
+ /**
45
+ * The setup step for one toolchain. A declared version wins; otherwise the
46
+ * version file the project keeps (`go.mod`, `.python-version`,
47
+ * `.java-version`), and otherwise the toolchain's current stable line. Paths
48
+ * are from the repository root, where the setup actions read them.
49
+ */
50
+ export function toolchainStep(decl, files, root) {
51
+ const name = typeof decl === "string" ? decl : decl.name;
52
+ const version = typeof decl === "string" ? undefined : decl.version;
53
+ const at = (f) => (root ? `${root}/${f}` : f);
54
+ switch (name) {
55
+ case "node":
56
+ return { name, uses: usesRef(ACTION_PINS.setupNode4), with: [["node-version", version ?? NODE_DEFAULT_VERSION], ["registry-url", "https://registry.npmjs.org"]] };
57
+ case "go":
58
+ return {
59
+ name,
60
+ uses: usesRef(ACTION_PINS.setupGo7),
61
+ with: [version ? ["go-version", version] : files.has("go.mod") ? ["go-version-file", at("go.mod")] : ["go-version", "stable"], ["cache", false]],
62
+ };
63
+ case "python":
64
+ return { name, uses: usesRef(ACTION_PINS.setupPython7), with: [version ? ["python-version", version] : files.has(".python-version") ? ["python-version-file", at(".python-version")] : ["python-version", "3.x"]] };
65
+ case "rust":
66
+ // The action reads rust-toolchain.toml when there is one, and installs stable when not.
67
+ return { name, uses: usesRef(ACTION_PINS.setupRustToolchain2), with: [...(version ? [["toolchain", version]] : []), ["cache", false], ["rustflags", ""]] };
68
+ case "java": {
69
+ const file = [".java-version", ".sdkmanrc", ".tool-versions"].find((f) => files.has(f));
70
+ return { name, uses: usesRef(ACTION_PINS.setupJava6), with: [["distribution", "temurin"], version ? ["java-version", version] : file ? ["java-version-file", at(file)] : ["java-version", "21"]] };
71
+ }
72
+ }
73
+ }
74
+ /**
75
+ * The toolchains a job sets up: those declared, or those the project's files
76
+ * name. `false` is none, the runner bringing its own. `withNode` adds Node
77
+ * first for a job that runs chant, at the declared version when there is one.
78
+ */
79
+ export function resolveToolchains(decl, files, root, withNode) {
80
+ if (decl === false)
81
+ return [];
82
+ const list = decl ? [...decl] : detectToolchains(files);
83
+ const named = (d) => (typeof d === "string" ? d : d.name);
84
+ const seen = new Set();
85
+ for (const d of list) {
86
+ const n = named(d);
87
+ if (!RELEASE_TOOLCHAINS.includes(n))
88
+ throw new Error(`release.workflow.toolchains: ${JSON.stringify(n)} is not one of ${RELEASE_TOOLCHAINS.join(", ")}`);
89
+ if (seen.has(n))
90
+ throw new Error(`release.workflow.toolchains: ${n} is named twice`);
91
+ seen.add(n);
92
+ }
93
+ if (withNode && !seen.has("node"))
94
+ list.unshift("node");
95
+ // Node first, so the chant the job runs is there before anything else.
96
+ list.sort((a, b) => (named(a) === "node" ? -1 : named(b) === "node" ? 1 : 0));
97
+ return list.map((d) => toolchainStep(d, files, root));
98
+ }
99
+ /** A step's lines in a GitHub or Forgejo job. Node renders as it always has: its inputs unquoted. */
100
+ export function toolchainLines(steps) {
101
+ return steps.flatMap((s) => [
102
+ ` - uses: ${s.uses}`,
103
+ ...(s.with.length > 0 ? [" with:", ...s.with.map(([k, v]) => ` ${k}: ${s.name === "node" ? String(v) : JSON.stringify(v)}`)] : []),
104
+ ]);
105
+ }
106
+ /** The workflow artifact a build job hands its outputs on in, and the tar archive inside it. */
107
+ export const releaseBuildArtifact = (name) => `chant-release-build-${name}`;
108
+ export const releaseBuildArchive = (name) => `${releaseBuildArtifact(name)}.tar`;
109
+ const OUTPUT = /^[A-Za-z0-9_@+.*?\[\]-][A-Za-z0-9_@+.*?\[\]/-]*$/;
110
+ /** Each build checked: a unique job name, a runner, a build, and outputs that stay inside the project. */
111
+ export function checkBuilds(builds) {
112
+ const where = "release.workflow.builds";
113
+ const names = new Set();
114
+ for (const b of builds) {
115
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(b.name))
116
+ throw new Error(`${where}: ${JSON.stringify(b.name)} is not a job name of lowercase letters, digits and dashes`);
117
+ if (names.has(b.name))
118
+ throw new Error(`${where}: ${b.name} is named twice`);
119
+ names.add(b.name);
120
+ const runners = Array.isArray(b.runner) ? b.runner : [b.runner];
121
+ if (runners.length === 0 || runners.some((r) => typeof r !== "string" || r.trim() === "" || /[\r\n]/.test(r)))
122
+ throw new Error(`${where}.${b.name}: runner is blank`);
123
+ if (typeof b.build !== "string" || b.build.trim() === "")
124
+ throw new Error(`${where}.${b.name}: build is blank`);
125
+ if (!Array.isArray(b.outputs) || b.outputs.length === 0)
126
+ throw new Error(`${where}.${b.name}: outputs names no file`);
127
+ for (const o of b.outputs) {
128
+ if (!OUTPUT.test(o) || o.split("/").includes("..") || o.startsWith("-")) {
129
+ throw new Error(`${where}.${b.name}: output ${JSON.stringify(o)} is not a path inside the project (letters, digits, ._@+-/ and the globs * ? [ ], with no .. and no leading / or -)`);
130
+ }
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,29 @@
1
+ import type { ReleaseGreenSource } from "../lifecycle/release-green.js";
2
+ import { type JobExtras, type ReleaseWorkflowForge } from "./release-workflow.js";
3
+ export interface TrainWorkflowInput {
4
+ forge: Exclude<ReleaseWorkflowForge, "gitlab">;
5
+ env: string;
6
+ trigger: "dispatch" | "tag";
7
+ chant: string;
8
+ install: string | null;
9
+ build: string | null;
10
+ root: string | null;
11
+ /** `chant workspace train publish`'s flags: `--require-provenance` under `supply-chain`, and `--yes`. */
12
+ flags: string;
13
+ after: string[];
14
+ /** The toolchain steps of the gate (Node, for chant) and of the jobs that build (#5152). */
15
+ chantSetup: string[];
16
+ fullSetup: string[];
17
+ extra: JobExtras;
18
+ /** The publish job's `GITHUB_TOKEN` line for a GitHub forge target, or nothing. */
19
+ forgeToken: string[];
20
+ /** The cut job's `GITHUB_TOKEN` line under `forge-checks` (#5149), or nothing. */
21
+ cutToken?: string[];
22
+ green: ReleaseGreenSource;
23
+ gate: "last-green" | "head";
24
+ lane?: string;
25
+ }
26
+ /** The tag a train's cut pushes, as a GitHub tag filter: `*` stops at `/`, so a member's own tag starts nothing. */
27
+ export declare function trainTagFilter(env: string): string;
28
+ /** GitHub and Forgejo: the train workflow (#5154). */
29
+ export declare function renderTrainWorkflow(o: TrainWorkflowInput): string;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The release workflow of a train (#5154): `chant release workflow` at a
3
+ * workspace root whose `chant.config.ts` declares `release.train` and
4
+ * `release.workflow`. The root's members release separately, each at its
5
+ * own label, and one run releases every member that changed.
6
+ *
7
+ * With `trigger: "dispatch"` a person starts it with the levels (default
8
+ * `auto`, the levels the commits and intent files give), and three jobs
9
+ * follow:
10
+ *
11
+ * - gate: the commit to release, as a dispatched release picks it (`chant ci
12
+ * last-green`, or the dispatched commit under `gate: "head"`).
13
+ * - cut: `chant workspace train cut <env> --at <commit> --levels <levels>
14
+ * --yes`, which picks the members, labels each past every version it
15
+ * already has, cuts them, records the train and pushes the member tags
16
+ * and `release-train/<env>/<id>` in one push. A commit with nothing to
17
+ * release ends the run here.
18
+ * - publish: in a checkout of the commit, `chant workspace train prepare`
19
+ * (stamp each member, build the packages they need), the build, and
20
+ * `chant workspace train publish <env> <id> --yes`, which stages, runs the
21
+ * members' `release.verify`, and reveals layer by layer.
22
+ *
23
+ * The publish job also runs on a pushed `release-train/<env>/*` tag, so a
24
+ * train cut from a workstation with `chant workspace train cut <env> --yes`
25
+ * publishes from the same file. With the tag trigger (the default) that is
26
+ * the whole workflow. A tag the job's own token pushed starts nothing, so a
27
+ * dispatched run publishes in its own publish job.
28
+ */
29
+ import { tagComments } from "../action-pins.js";
30
+ import { field, gateScript, githubSetup, LEDGER_FETCH_FIRST } from "./release-workflow.js";
31
+ /** The tag a train's cut pushes, as a GitHub tag filter: `*` stops at `/`, so a member's own tag starts nothing. */
32
+ export function trainTagFilter(env) {
33
+ return `release-train/${env}/*`;
34
+ }
35
+ /** GitHub and Forgejo: the train workflow (#5154). */
36
+ export function renderTrainWorkflow(o) {
37
+ const defaults = o.root ? [" defaults:", " run:", ` working-directory: ${o.root}`] : [];
38
+ const run = (l) => ` - run: ${l}`;
39
+ const block = (lines) => [" run: |", ...lines.map((l) => ` ${l}`)];
40
+ const installLines = o.install ? [run(o.install)] : [];
41
+ const ciFetch = run("git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'");
42
+ const ledgerFetch = run("git fetch origin chant/lifecycle:chant/lifecycle");
43
+ const dispatch = o.trigger === "dispatch";
44
+ const env = o.env;
45
+ const lines = [
46
+ "name: chant release train",
47
+ "on:",
48
+ ...(dispatch
49
+ ? [
50
+ " workflow_dispatch:",
51
+ " inputs:",
52
+ " levels:",
53
+ " description: auto for the levels the commits and intent files give, a level for every member (major, minor or patch), or <member>=<level>, separated by spaces",
54
+ " required: false",
55
+ " default: auto",
56
+ " type: string",
57
+ ]
58
+ : []),
59
+ " push:",
60
+ ` tags: [${JSON.stringify(trainTagFilter(env))}]`,
61
+ "permissions:",
62
+ " contents: write",
63
+ " id-token: write",
64
+ ...o.extra.permissions,
65
+ "concurrency:",
66
+ " group: chant-release",
67
+ " cancel-in-progress: false",
68
+ "jobs:",
69
+ ];
70
+ if (dispatch) {
71
+ lines.push(" gate:", " if: github.event_name == 'workflow_dispatch'", " runs-on: ubuntu-latest", ...defaults, " outputs:", " commit: ${{ steps.green.outputs.commit }}", " steps:", ...githubSetup(undefined, o.chantSetup), ...installLines, ciFetch, " - id: green", ...block([...gateScript(o, "$GITHUB_SHA"), 'echo "commit=$commit" >> "$GITHUB_OUTPUT"']), " cut:", " needs: gate", " runs-on: ubuntu-latest", ...defaults, " outputs:", " train: ${{ steps.cut.outputs.train }}", ...o.extra.githubEnv([" CHANT_RELEASE_COMMIT: ${{ needs.gate.outputs.commit }}", " CHANT_RELEASE_LEVELS: ${{ inputs.levels }}", ...(o.cutToken ?? [])]), " steps:", ...githubSetup("${{ needs.gate.outputs.commit }}", o.fullSetup), ...installLines, ...o.extra.githubSteps, ciFetch, run(LEDGER_FETCH_FIRST), " - id: cut", ...block([
72
+ 'git config user.name "chant release"',
73
+ 'git config user.email "chant-release@localhost"',
74
+ `${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}" --yes --json > "$RUNNER_TEMP/chant-train.json"`,
75
+ `echo "train=$(${field("d.train?.id")} "$RUNNER_TEMP/chant-train.json")" >> "$GITHUB_OUTPUT"`,
76
+ ]));
77
+ }
78
+ const publishIf = dispatch ? " if: ${{ always() && (github.event_name == 'push' || (needs.cut.result == 'success' && needs.cut.outputs.train != '')) }}" : null;
79
+ const trainFromRef = `echo "CHANT_RELEASE_TRAIN=\${CHANT_RELEASE_TRAIN:-\${GITHUB_REF_NAME#release-train/${env}/}}" >> "$GITHUB_ENV"`;
80
+ lines.push(" publish:", ...(dispatch ? [" needs: [gate, cut]", publishIf] : []), " runs-on: ubuntu-latest", ...defaults, ...o.extra.githubEnv([...(dispatch ? [" CHANT_RELEASE_TRAIN: ${{ needs.cut.outputs.train }}"] : []), ...o.forgeToken]), " steps:", ...githubSetup(dispatch ? "${{ needs.gate.outputs.commit || github.sha }}" : undefined, o.fullSetup), ...installLines, ...o.extra.githubSteps, ciFetch, ledgerFetch, run(trainFromRef), run(`${o.chant} workspace train prepare ${env} "$CHANT_RELEASE_TRAIN"`), ...(o.build ? [run(o.build)] : []), run('git config user.name "chant release"'), run('git config user.email "chant-release@localhost"'), run(`${o.chant} workspace train publish ${env} "$CHANT_RELEASE_TRAIN" ${o.flags}`));
81
+ if (o.after.length > 0) {
82
+ lines.push(" after-release:", ` needs: ${dispatch ? "[gate, cut, publish]" : "publish"}`, ...(dispatch ? [" if: ${{ always() && needs.publish.result == 'success' }}"] : []), " runs-on: ubuntu-latest", ...defaults, ...(dispatch ? [" env:", " CHANT_RELEASE_TRAIN: ${{ needs.cut.outputs.train }}"] : []), " steps:", ...githubSetup(dispatch ? "${{ needs.gate.outputs.commit || github.sha }}" : undefined, o.fullSetup), run(trainFromRef), ...installLines, ...o.after.map(run));
83
+ }
84
+ return tagComments(`${lines.join("\n")}\n`);
85
+ }
@@ -7,7 +7,9 @@
7
7
  * train names one of them per member: by default the newest cut release, or
8
8
  * the one `--pin <member>=<label|digest>` picks. It refuses unless every
9
9
  * `chant` member of the declaration has a release, so a train never leaves a
10
- * member out. It is written to `_members/_workspace/<env>/trains.jsonl`.
10
+ * member out. It is written to `_members/_workspace/<env>/trains.jsonl`, or
11
+ * for a nested workspace inside its outer member's ledger
12
+ * (`_members/<outer>/_members/_workspace/<env>/trains.jsonl`).
11
13
  *
12
14
  * A train's digest (#4037) is over the member release digests and nothing
13
15
  * else, so the same picks always give the same train digest, whatever the
@@ -7,7 +7,9 @@
7
7
  * train names one of them per member: by default the newest cut release, or
8
8
  * the one `--pin <member>=<label|digest>` picks. It refuses unless every
9
9
  * `chant` member of the declaration has a release, so a train never leaves a
10
- * member out. It is written to `_members/_workspace/<env>/trains.jsonl`.
10
+ * member out. It is written to `_members/_workspace/<env>/trains.jsonl`, or
11
+ * for a nested workspace inside its outer member's ledger
12
+ * (`_members/<outer>/_members/_workspace/<env>/trains.jsonl`).
11
13
  *
12
14
  * A train's digest (#4037) is over the member release digests and nothing
13
15
  * else, so the same picks always give the same train digest, whatever the
@@ -96,6 +98,9 @@ export async function readMemberReleases(cwd, opts = {}) {
96
98
  const located = locateWorkspace(cwd);
97
99
  const declaration = readDeclaration(located.tree, "", { rootChant: true });
98
100
  const out = [];
101
+ // #5136: in a nested workspace each member's ledger sits inside the outer member's.
102
+ const { resolveMemberLedger } = await import("../lifecycle/member-ledger.js");
103
+ const outer = (await resolveMemberLedger(located.rootOnDisk)).members;
99
104
  for (const m of declaration.members) {
100
105
  if (m.kind === REPO_KIND && m.repo !== null) {
101
106
  out.push(await (opts.readRepo ?? readRepoReleases)(m.name, m.repo, located.rootOnDisk));
@@ -103,7 +108,7 @@ export async function readMemberReleases(cwd, opts = {}) {
103
108
  }
104
109
  if (m.kind !== "chant")
105
110
  continue;
106
- const loc = { cwd: located.rootOnDisk, member: m.dir === "." ? "." : m.name };
111
+ const loc = { cwd: located.rootOnDisk, member: m.dir === "." ? outer : [...outer, m.name] };
107
112
  const { releases } = await readAllReleases(loc);
108
113
  const { cuts } = await readCuts(loc);
109
114
  const newest = (digest) => cuts.filter((c) => c.releaseDigest === digest).map((c) => c.timestamp).sort().at(-1) ?? "";
@@ -489,7 +494,7 @@ async function promoteAcrossRepos(query, train, now) {
489
494
  }
490
495
  return { kind: "ran", train, record, pending: null, approved: null, ledgerError };
491
496
  }
492
- const USAGE = "chant workspace train <env> [--pin <member>=<label|digest>]... [--dry-run] [--json] | chant workspace train list <env> [--json] | chant workspace train promote <env> [<train id|digest>] [--gate <name>] [--continue] [--dry-run] [--json]";
497
+ const USAGE = "chant workspace train <env> [--pin <member>=<label|digest>]... [--dry-run] [--json] | chant workspace train list <env> [--json] | chant workspace train promote <env> [<train id|digest>] [--gate <name>] [--continue] [--dry-run] [--json] | chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--yes] [--no-push] [--json] | chant workspace train prepare <env> [<train id|digest>] [--json] | chant workspace train publish <env> [<train id|digest>] [--yes] [--json]";
493
498
  /** Each train with the runs that promoted it, oldest first. */
494
499
  export function trainsWithPromotions(trains, runs) {
495
500
  const latest = latestRuns(runs);
@@ -512,6 +517,18 @@ export async function runWorkspaceTrain(ctx) {
512
517
  const rest = words[0] === "train" ? words.slice(1) : words;
513
518
  if (rest[0] === "promote")
514
519
  return runTrainPromote(ctx, rest.slice(1));
520
+ if (rest[0] === "cut") {
521
+ const { runTrainCut } = await import("./train-cut.js");
522
+ return runTrainCut(ctx, rest.slice(1));
523
+ }
524
+ if (rest[0] === "prepare") {
525
+ const { runTrainPrepare } = await import("./train-prepare.js");
526
+ return runTrainPrepare(ctx, rest.slice(1));
527
+ }
528
+ if (rest[0] === "publish") {
529
+ const { runTrainPublish } = await import("./train-publish.js");
530
+ return runTrainPublish(ctx, rest.slice(1));
531
+ }
515
532
  const listing = rest[0] === "list";
516
533
  const env = listing ? rest[1] : rest[0];
517
534
  if (!env) {
@@ -1,17 +1,20 @@
1
+ import { type MemberTags } from "../lifecycle/release-tag.js";
1
2
  import type { SecurityGroup } from "./security.js";
2
3
  import type { OpSetupStep } from "../lexicon.js";
4
+ import { type ReleaseBuildConfig, type ReleaseToolchainDecl } from "./release-toolchains.js";
5
+ import { type ReleaseWorkflowContext } from "./release-steps/index.js";
3
6
  export declare const RELEASE_WORKFLOW_FORGES: readonly ["github", "forgejo", "gitlab"];
4
7
  export type ReleaseWorkflowForge = (typeof RELEASE_WORKFLOW_FORGES)[number];
5
8
  /** Where each forge's publish workflow is written, relative to the repository root. */
6
9
  export declare const RELEASE_WORKFLOW_FILES: Record<ReleaseWorkflowForge, string>;
7
10
  /** `release.workflow` in `chant.config.ts` (#4656): how the release pipeline starts and what it runs. */
8
11
  export interface ReleasePipelineConfig {
9
- /** `tag` (default): the publish job runs on a `release/**` tag. `dispatch`: the whole release starts by hand with a label. */
12
+ /** `tag` (default): the publish job runs on the tag the cut made (`release.tag`, default `release/**`). `dispatch`: the whole release starts by hand with a label. */
10
13
  trigger?: "tag" | "dispatch";
11
14
  /** For `dispatch`: the commit to cut. `last-green` (default) is the newest green commit at or below the dispatched one; `head` is the dispatched commit, which must be green. */
12
15
  gate?: "last-green" | "head";
13
- /** The command that installs what the build needs. Default `npm ci`. */
14
- install?: string;
16
+ /** The command that installs what the build needs. Default `npm ci` for a project with a package.json, none otherwise. `false` for none. */
17
+ install?: string | false;
15
18
  /** The command that builds what the targets upload, run by the cut (as its `--build`) and the publish job. `false` for none. Default `npm run build`. */
16
19
  build?: string | false;
17
20
  /** What runs chant. Default `npx chant`. */
@@ -39,15 +42,46 @@ export interface ReleasePipelineConfig {
39
42
  * the platforms `release.images` builds is set up without one (#4876).
40
43
  */
41
44
  setup?: OpSetupStep[];
45
+ /**
46
+ * The toolchains the jobs set up (#5152): `node`, `go`, `python`, `rust`,
47
+ * `java`, each by name or as `{ name, version }`. Default: those the
48
+ * project's root files name (`package.json`, `go.mod`, `pyproject.toml`,
49
+ * `Cargo.toml`, `pom.xml`, ...). Jobs that run chant get Node as well.
50
+ * `false` sets up nothing; the runner brings its own. GitHub and Forgejo;
51
+ * GitLab jobs take theirs from the runner's image and refuse it by name.
52
+ */
53
+ toolchains?: ReleaseToolchainDecl[] | false;
54
+ /**
55
+ * Per-platform build jobs (#5152), each on its own runner (a native arm64
56
+ * runner, macOS, Windows), run after the gate and before the cut. Each
57
+ * hands its `outputs` to the cut and publish jobs, where they land at the
58
+ * same paths in the checkout before `chant release cut` runs. `dispatch`
59
+ * only: with the tag trigger the release was cut before the workflow ran.
60
+ */
61
+ builds?: ReleaseBuildConfig[];
42
62
  /** Where the workflow is written, from the repository root, such as `.github/workflows/publish.yml` for an npm trusted publisher that names that file. Default {@link RELEASE_WORKFLOW_FILES}. */
43
63
  file?: string;
64
+ /**
65
+ * Run `chant release doctor` before anything is published (#5161). With
66
+ * `trigger: "dispatch"` the cut job runs it before the cut, so a target
67
+ * that can't publish stops the release before a tag exists; on by default
68
+ * there, `false` turns it off. With `trigger: "tag"` the cut already
69
+ * happened, and `true` runs it in the publish job before the build.
70
+ */
71
+ doctor?: boolean;
44
72
  }
45
73
  export interface ReleaseWorkflowInput {
46
74
  forge: ReleaseWorkflowForge;
47
75
  /** The security groups the workspace opts into at its root. */
48
76
  groups: ReadonlySet<SecurityGroup>;
49
- /** The command that installs what the build needs. Default `npm ci`. */
50
- install?: string;
77
+ /** The command that installs what the build needs, or none. Default `npm ci`. */
78
+ install?: string | null;
79
+ /**
80
+ * The toolchain files at the project's root (#5152), from
81
+ * `TOOLCHAIN_MARKERS`: what the jobs set up when `release.workflow.toolchains`
82
+ * names none. Absent, the jobs set up Node alone, as they always did.
83
+ */
84
+ projectFiles?: readonly string[];
51
85
  /** The command that builds what the targets upload, or none. Default `npm run build`. */
52
86
  build?: string | null;
53
87
  /** What runs chant. Default `npx chant`. */
@@ -74,6 +108,43 @@ export interface ReleaseWorkflowInput {
74
108
  imagePlatforms?: string[];
75
109
  /** `release.lane` (#4692): the gate's green lane. */
76
110
  lane?: string;
111
+ /**
112
+ * The config declares `release.artifacts` (#5151). In a dispatched release
113
+ * the cut job stages the files it built (`chant release artifacts --no-build
114
+ * -o`) and hands them to the publish job as the workflow artifact
115
+ * {@link RELEASE_ARTIFACTS_ARTIFACT}, which checks them against the record
116
+ * (`--from`) before the publish. On a release tag the publish job builds
117
+ * them again and checks them.
118
+ */
119
+ artifacts?: boolean;
120
+ /**
121
+ * An entry of `release.artifacts` is built by goreleaser (#5151): the job
122
+ * that builds the files installs the goreleaser {@link TOOL_PINS} pins,
123
+ * checked by SHA-256, and on GitHub and Forgejo sets up Go from the
124
+ * member's `go.mod`.
125
+ */
126
+ goreleaser?: boolean;
127
+ /**
128
+ * The green gate the cut checks (#5149), `release.green` resolved. Under
129
+ * `forge-checks` or `none` a dispatched release's gate names the
130
+ * dispatched commit, since no `ci/green` tag exists to search, and the cut
131
+ * checks it; under `forge-checks` the cut job gets the run's token and,
132
+ * on GitHub, `checks: read` and `statuses: read`. Default `chant`.
133
+ */
134
+ green?: import("../lifecycle/release-green.js").ReleaseGreenSource;
135
+ /**
136
+ * `release.tag` (#5150) and where it renders. A tag-triggered workflow runs
137
+ * on the tags it makes, and its publish job reads the label of the tag that
138
+ * started it from the ledger (`chant release tag`). Absent, or the legacy
139
+ * default: the `release/**` file it always was.
140
+ */
141
+ tags?: MemberTags;
142
+ /**
143
+ * The publish signs with Sigstore (#5164): `release.signing` or the
144
+ * `supply-chain` group, with an `oci` or `forge` target. The jobs download
145
+ * cosign pinned by SHA-256 ({@link cosignSetup}).
146
+ */
147
+ signing?: boolean;
77
148
  /**
78
149
  * The config declares `release.version` (#4840): the publish job runs
79
150
  * `chant release stamp <label>` before the images and the build, so what
@@ -87,6 +158,14 @@ export interface ReleaseWorkflowInput {
87
158
  * token unless `release.workflow.env` sets it.
88
159
  */
89
160
  publish?: ReadonlyArray<ReleaseWorkflowTarget>;
161
+ /**
162
+ * `release.train` at the workspace root (#5154): the workflow releases the
163
+ * root's members as a train, recorded for `env`, rather than the root as
164
+ * one member. See ./release-train-workflow.ts.
165
+ */
166
+ train?: {
167
+ env: string;
168
+ };
90
169
  }
91
170
  /** What the generator reads of a `release.publish` target: enough to know which credentials and tools its job needs. */
92
171
  export interface ReleaseWorkflowTarget {
@@ -99,67 +178,87 @@ export interface ReleaseWorkflowTarget {
99
178
  passwordEnv?: string;
100
179
  /** An `npm` target's registry. */
101
180
  registry?: string;
181
+ /** A `pypi` target's `auth`, `index` and `uploadUrl`. */
182
+ auth?: string;
183
+ index?: string;
184
+ uploadUrl?: string;
102
185
  }
103
- /** npm trusted publishing needs this npm or later (#4786). */
104
- export declare const NPM_TRUSTED_PUBLISHING_MIN = "11.5.1";
105
- /** The npm a publish job installs when the runner's Node bundles one older than {@link NPM_TRUSTED_PUBLISHING_MIN}. */
106
- export declare const NPM_TRUSTED_PUBLISHING_VERSION = "11.19.0";
107
- /**
108
- * The shell line that installs {@link NPM_TRUSTED_PUBLISHING_VERSION} when the
109
- * runner's npm is older than {@link NPM_TRUSTED_PUBLISHING_MIN}, and prints the
110
- * npm in use.
111
- */
112
- export declare const NPM_TRUSTED_PUBLISHING_SETUP = "have=\"$(npm --version)\"; if [ \"$(printf '%s\\n' \"11.5.1\" \"$have\" | sort -V | head -n1)\" != \"11.5.1\" ]; then npm install -g npm@11.19.0; fi; npm --version";
113
- /**
114
- * What a GitHub release workflow needs for its targets, worked out from them
115
- * (#4786), so no product wires it by hand:
116
- *
117
- * - an `oci` target on `ghcr.io` that names no credentials pushes with the
118
- * job's token: `packages: write`, and `OCI_USERNAME` and `OCI_PASSWORD`
119
- * from `github.actor` and `github.token`;
120
- * - an `npm` target on npmjs publishes with trusted publishing, which needs
121
- * npm {@link NPM_TRUSTED_PUBLISHING_MIN}: the jobs upgrade npm when the
122
- * runner's is older.
123
- *
124
- * `release.workflow` wins: a scope, variable or the same setup line it names
125
- * is not added again. Other forges, and configs without such targets, get
126
- * nothing.
127
- */
128
- export declare function targetExtras(forge: ReleaseWorkflowForge, targets: ReadonlyArray<ReleaseWorkflowTarget>, p: ReleasePipelineConfig): Pick<ReleasePipelineConfig, "permissions" | "env" | "setup">;
129
- /** The platform the jobs `chant release workflow` writes run on: GitHub's and Forgejo's `ubuntu-latest`, and a GitLab runner's default (#4876). */
130
- export declare const RELEASE_RUNNER_PLATFORM = "linux/amd64";
131
- /** The binfmt image a GitLab job installs QEMU's handlers with (#4876): the repository, which a config's own setup line is recognised by. */
132
- export declare const RELEASE_BINFMT_IMAGE: string;
133
- /** The architectures among `platforms` the runner can't run, as QEMU names them (`linux/arm/v7` is `arm`), each once. */
134
- export declare function qemuArchitectures(platforms: readonly string[]): string[];
135
- /**
136
- * QEMU's binfmt setup for the platforms `release.images` builds that the
137
- * runner can't, such as `linux/arm64` on an amd64 runner (#4876), so no
138
- * product names it in `release.workflow.setup`. GitHub and Forgejo get
139
- * `docker/setup-qemu-action` at its pin; GitLab a `docker run --privileged`
140
- * of {@link RELEASE_BINFMT_IMAGE} by the digest `IMAGE_PINS.binfmt` records
141
- * (#4941, ../image-pins.ts), which `chant release workflow` notes needs
142
- * an executor that runs privileged containers. A config whose `setup` names
143
- * the action or the binfmt image already gets nothing more, so its file
144
- * renders as it did.
145
- */
146
- export declare function qemuSetup(forge: ReleaseWorkflowForge, platforms: readonly string[], p: ReleasePipelineConfig): OpSetupStep[];
186
+ export { RELEASE_RUNNER_PLATFORM } from "./release-steps/types.js";
187
+ export { NPM_TRUSTED_PUBLISHING_MIN, NPM_TRUSTED_PUBLISHING_SETUP, NPM_TRUSTED_PUBLISHING_VERSION, targetExtras } from "./release-steps/targets.js";
188
+ export { RELEASE_BINFMT_IMAGE, qemuArchitectures, qemuSetup } from "./release-steps/qemu.js";
189
+ export { RELEASE_ARTIFACTS_ARTIFACT, RELEASE_ARTIFACTS_STAGE } from "./release-steps/artifacts.js";
190
+ export { goreleaserSetup } from "./release-steps/goreleaser.js";
191
+ export { cosignSetup } from "./release-steps/signing.js";
192
+ export { RELEASE_DIGESTS_FILE, RELEASE_DIGESTS_PATHS, RELEASE_IMAGES_ARTIFACT } from "./release-steps/images.js";
147
193
  /** The flags `chant release publish` gets under the groups. */
148
194
  export declare function publishFlags(groups: ReadonlySet<SecurityGroup>): string[];
149
- /** Where `chant release images` writes the digests the publish job's build reads (#4657), by default and at a workstation. */
150
- export declare const RELEASE_DIGESTS_FILE = ".chant/release-digests.json";
151
- /**
152
- * Where a generated publish job writes the digests: the runner's temp
153
- * directory, outside the checkout, so `chant release publish` finds the tree
154
- * as the cut left it (#4853). A repository that commits files under `.chant/`
155
- * can't ignore the directory, and a digests file there made the publish
156
- * refuse with `release-worktree-dirty`.
157
- */
158
- export declare const RELEASE_DIGESTS_PATHS: Record<ReleaseWorkflowForge, string>;
159
195
  /** The workflow file's text, without the generated-by header. */
160
196
  export declare function renderReleaseWorkflow(input: ReleaseWorkflowInput): string;
161
- /** The workflow artifact the cut job hands its image archives on in. */
162
- export declare const RELEASE_IMAGES_ARTIFACT = "chant-release-images";
197
+ /**
198
+ * The filters for the tags a template makes (#5150): GitHub and Forgejo
199
+ * globs (the release tags, and a negated pattern for the floating tag so its
200
+ * move starts nothing), and GitLab's rule.
201
+ */
202
+ export declare function releaseTagFilters(tags: MemberTags): {
203
+ globs: string[];
204
+ gitlabRule: string;
205
+ };
206
+ export interface JobExtras {
207
+ /** Lines added under the workflow's `permissions:`. */
208
+ permissions: string[];
209
+ /** The job's `env:` block with `base` entries first, or nothing when there is neither. */
210
+ githubEnv: (base: string[]) => string[];
211
+ /** Steps after the install. */
212
+ githubSteps: string[];
213
+ /** GitLab: the job's `variables:` entries, under a `variables:` key of their own. */
214
+ gitlabVariables: string[];
215
+ /** GitLab: script lines after the install. */
216
+ gitlabScript: string[];
217
+ }
218
+ /** `release.workflow`'s `permissions`, `env` and `setup` (#4751) as lines of the forge's file. Empty for a config without them, so its file is what it was. */
219
+ export declare function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobExtras;
220
+ /** The checkout and toolchain setup a GitHub or Forgejo job starts with (#5152); `ref` checks out that commit. */
221
+ export declare function githubSetup(ref: string | undefined, setup: readonly string[], persist?: boolean): string[];
222
+ interface DispatchInput {
223
+ /** What the features read (#5196). */
224
+ context: ReleaseWorkflowContext;
225
+ chant: string;
226
+ install: string | null;
227
+ /** The toolchain steps of the gate (Node, for chant) and of the jobs that build (#5152). */
228
+ chantSetup: string[];
229
+ fullSetup: string[];
230
+ /** The per-platform builds (#5152), each with its toolchain steps. */
231
+ builds: Array<ReleaseBuildConfig & {
232
+ setup: string[];
233
+ }>;
234
+ build: string | null;
235
+ root: string | null;
236
+ flags: string;
237
+ after: string[];
238
+ forge: ReleaseWorkflowForge;
239
+ gate: "last-green" | "head";
240
+ lane?: string;
241
+ extra: JobExtras;
242
+ /** The publish job's `GITHUB_TOKEN` line for a GitHub forge target (#4767), or nothing. */
243
+ forgeToken: string[];
244
+ /** The cut job's `GITHUB_TOKEN` line under `forge-checks` (#5149), or nothing. */
245
+ cutToken: string[];
246
+ /** The green gate the cut checks (#5149). */
247
+ green: import("../lifecycle/release-green.js").ReleaseGreenSource;
248
+ /** The cut job runs `chant release doctor` before the cut (#5161), with the publish job's forge token. */
249
+ doctor: boolean;
250
+ }
251
+ /** The node one-liner that prints a JSON document's field from stdin, or from the file its argument names. */
252
+ export declare const field: (path: string) => string;
253
+ /** The gate's shell: the commit to cut, from `ci last-green`, refused when there is none or, under `head`, when it is not the dispatched one. */
254
+ export declare function gateScript(o: Pick<DispatchInput, "green" | "chant" | "lane" | "gate" | "forge">, dispatched: string): string[];
255
+ /**
256
+ * The cut job's fetch of `chant/lifecycle`. A repository's first release has
257
+ * no ledger branch yet, and the cut is what creates it, so a remote without
258
+ * the branch is not an error here; any other failure of git still stops the
259
+ * job. The publish job runs after the cut has pushed it and fetches it plainly.
260
+ */
261
+ export declare const LEDGER_FETCH_FIRST = "rc=0; git ls-remote --exit-code --heads origin chant/lifecycle >/dev/null || rc=$?; if [ \"$rc\" = 0 ]; then git fetch origin chant/lifecycle:chant/lifecycle; elif [ \"$rc\" != 2 ]; then exit \"$rc\"; fi";
163
262
  /** The header that marks the file generated, naming the command that regenerates it. */
164
263
  export declare function releaseWorkflowHeader(command: string): string;
165
264
  /**