@intentius/chant 0.124.70 → 0.124.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-agent.d.ts +12 -1
- package/dist/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +13 -8
- package/dist/ci-commit.d.ts +326 -0
- package/dist/ci-commit.d.ts.map +1 -0
- package/dist/ci-commit.js +725 -0
- package/dist/ci-estate/delivery.d.ts +75 -2
- package/dist/ci-estate/delivery.d.ts.map +1 -1
- package/dist/ci-estate/delivery.js +129 -0
- package/dist/ci-estate.d.ts +3 -1
- package/dist/ci-estate.d.ts.map +1 -1
- package/dist/ci-estate.js +4 -1
- package/dist/ci-product-words.d.ts +6 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +3 -1
- package/dist/ci-product.d.ts +1 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +1 -1
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +7 -2
- package/dist/cli/handlers/commit.d.ts +26 -0
- package/dist/cli/handlers/commit.d.ts.map +1 -0
- package/dist/cli/handlers/commit.js +145 -0
- package/dist/cli/handlers/notify-relay.d.ts.map +1 -1
- package/dist/cli/handlers/notify-relay.js +22 -2
- package/dist/cli/handlers/pr.d.ts +6 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +16 -7
- package/dist/cli/handlers/release.d.ts +9 -0
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +114 -5
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +17 -0
- package/dist/components/product-pipeline.d.ts +33 -0
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +34 -1
- package/dist/components/release-compile.d.ts +2 -0
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +8 -4
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -0
- package/dist/lexicon.d.ts +54 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lexicon.js +28 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +4 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
- package/dist/lifecycle/__fixtures__/publish-fakes.js +6 -2
- package/dist/lifecycle/gated-request.d.ts +3 -1
- package/dist/lifecycle/gated-request.d.ts.map +1 -1
- package/dist/lifecycle/gated-request.js +5 -2
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +57 -0
- package/dist/lifecycle/publish-declaration.d.ts +16 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +35 -3
- package/dist/lifecycle/publish-forge.d.ts +12 -0
- package/dist/lifecycle/publish-forge.d.ts.map +1 -1
- package/dist/lifecycle/publish-forge.js +102 -19
- package/dist/lifecycle/publish-npm.d.ts +15 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +28 -1
- package/dist/lifecycle/publish-oci.d.ts +2 -0
- package/dist/lifecycle/publish-oci.d.ts.map +1 -1
- package/dist/lifecycle/publish-oci.js +10 -0
- package/dist/lifecycle/release-cut.d.ts +7 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +8 -1
- package/dist/lifecycle/release-images.d.ts +87 -0
- package/dist/lifecycle/release-images.d.ts.map +1 -0
- package/dist/lifecycle/release-images.js +138 -0
- package/dist/lifecycle/release-publish.d.ts +2 -0
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/notify-relay.d.ts +41 -1
- package/dist/notify-relay.d.ts.map +1 -1
- package/dist/notify-relay.js +40 -0
- package/dist/notify.d.ts +16 -3
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +16 -10
- package/dist/op/activities/review-agent.d.ts.map +1 -1
- package/dist/op/activities/review-agent.js +4 -2
- package/dist/op/gate.d.ts +5 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +7 -2
- package/dist/op/op-waves-notify.d.ts +1 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +2 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +12 -8
- package/dist/op/op-waves.d.ts +9 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +11 -0
- package/dist/pr-forge-base.d.ts +18 -0
- package/dist/pr-forge-base.d.ts.map +1 -0
- package/dist/pr-forge-base.js +29 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +315 -315
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +1 -2
- package/dist/workspace/release-workflow.d.ts +47 -0
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +258 -14
- package/package.json +1 -1
- package/src/ci-agent.ts +13 -8
- package/src/ci-commit.test.ts +415 -0
- package/src/ci-commit.ts +901 -0
- package/src/ci-estate/__fixtures__/terragucci-dora.json +1305 -0
- package/src/ci-estate/delivery.ts +186 -2
- package/src/ci-estate/records-delivery.test.ts +55 -0
- package/src/ci-estate.ts +10 -0
- package/src/ci-product-words.ts +6 -2
- package/src/ci-product.ts +1 -0
- package/src/cli/handlers/approve.ts +6 -2
- package/src/cli/handlers/commit.ts +155 -0
- package/src/cli/handlers/notify-relay.ts +21 -2
- package/src/cli/handlers/operator.test.ts +2 -0
- package/src/cli/handlers/pr-wave-approve-lines.test.ts +32 -0
- package/src/cli/handlers/pr.ts +17 -7
- package/src/cli/handlers/release.ts +110 -5
- package/src/cli/main.ts +17 -0
- package/src/components/product-pipeline.test.ts +28 -1
- package/src/components/product-pipeline.ts +54 -1
- package/src/components/release-compile.ts +9 -3
- package/src/config.ts +31 -0
- package/src/lexicon.ts +72 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +11 -5
- package/src/lifecycle/gated-request-spend.test.ts +115 -0
- package/src/lifecycle/gated-request.ts +5 -2
- package/src/lifecycle/git.ts +53 -0
- package/src/lifecycle/ledger-two-clones.test.ts +132 -0
- package/src/lifecycle/publish-declaration.ts +35 -3
- package/src/lifecycle/publish-forge-notes.test.ts +193 -0
- package/src/lifecycle/publish-forge.ts +100 -22
- package/src/lifecycle/publish-npm.ts +31 -2
- package/src/lifecycle/publish-oci.ts +10 -0
- package/src/lifecycle/publish-targets.test.ts +2 -1
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images.test.ts +242 -0
- package/src/lifecycle/release-images.ts +174 -0
- package/src/lifecycle/release-publish.ts +2 -0
- package/src/notify-relay.test.ts +55 -1
- package/src/notify-relay.ts +49 -1
- package/src/notify.ts +25 -12
- package/src/op/activities/review-agent.test.ts +20 -1
- package/src/op/activities/review-agent.ts +5 -2
- package/src/op/gate.ts +7 -2
- package/src/op/op-waves-approve-target.test.ts +108 -0
- package/src/op/op-waves-notify.ts +2 -2
- package/src/op/op-waves-run.ts +12 -7
- package/src/op/op-waves.ts +12 -0
- package/src/pr-forge-base.test.ts +37 -0
- package/src/pr-forge-base.ts +36 -0
- package/src/release-floors.ts +1 -1
- package/src/workspace/__fixtures__/release-workflow/forgejo-plain-member.yml +26 -0
- package/src/workspace/__fixtures__/release-workflow/forgejo-plain.yml +23 -0
- package/src/workspace/__fixtures__/release-workflow/forgejo-secure-member.yml +27 -0
- package/src/workspace/__fixtures__/release-workflow/forgejo-secure.yml +24 -0
- package/src/workspace/__fixtures__/release-workflow/github-plain-member.yml +26 -0
- package/src/workspace/__fixtures__/release-workflow/github-plain.yml +23 -0
- package/src/workspace/__fixtures__/release-workflow/github-secure-member.yml +27 -0
- package/src/workspace/__fixtures__/release-workflow/github-secure.yml +24 -0
- package/src/workspace/__fixtures__/release-workflow/gitlab-plain-member.yml +13 -0
- package/src/workspace/__fixtures__/release-workflow/gitlab-plain.yml +12 -0
- package/src/workspace/__fixtures__/release-workflow/gitlab-secure-member.yml +14 -0
- package/src/workspace/__fixtures__/release-workflow/gitlab-secure.yml +13 -0
- package/src/workspace/ci-green.ts +1 -2
- package/src/workspace/release-workflow.test.ts +199 -0
- package/src/workspace/release-workflow.ts +356 -14
|
@@ -8,7 +8,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { afterAll, describe, expect, test, vi } from "vitest";
|
|
11
|
-
import type
|
|
11
|
+
import { composeChangeSet, type ChangeSetDocument } from "../../change-set";
|
|
12
12
|
import { behaviourFindingMarker } from "./predict-behaviour";
|
|
13
13
|
import { commentMarker, type ReconcilePrArgs, type ReconcileResult } from "./reconcile";
|
|
14
14
|
import {
|
|
@@ -388,6 +388,25 @@ describe("the note job posts a handed-on review (#4326)", () => {
|
|
|
388
388
|
expect(posted[0]!.body).not.toContain("evil.example");
|
|
389
389
|
});
|
|
390
390
|
|
|
391
|
+
test("a composed change set's digest survives the handoff, and the note names its first 12 hex characters (#4726)", async () => {
|
|
392
|
+
const composed = composeChangeSet([]);
|
|
393
|
+
expect(composed.digest).toMatch(/^jcs1-sha256:[0-9a-f]{64}$/);
|
|
394
|
+
const { run, written } = harness({ review: "risk: low" });
|
|
395
|
+
const result = await run({ op: "pr-review", changeSet: composed, mode: "handoff", dir: "/r" });
|
|
396
|
+
const text = written[result.recordFile!]!;
|
|
397
|
+
expect(readReviewRecord(text)!.digest).toBe(composed.digest);
|
|
398
|
+
const { post, posted } = poster({ "/r/review.json": text });
|
|
399
|
+
await post({ op: "pr-review", dir: "/r" });
|
|
400
|
+
const hex = composed.digest.slice("jcs1-sha256:".length, "jcs1-sha256:".length + 12);
|
|
401
|
+
expect(posted[0]!.body).toContain(`### Review of change set \`${hex}\``);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test("a sha256: digest is kept and shortened after its prefix", () => {
|
|
405
|
+
expect(readReviewRecord(record())!.digest).toBe("sha256:0123456789abcdef0123");
|
|
406
|
+
const body = reviewNoteBody({ review: "risk: low", exitCode: 0, digest: "sha256:0123456789abcdef0123", instructions: "base" });
|
|
407
|
+
expect(body).toContain("### Review of change set `0123456789ab`");
|
|
408
|
+
});
|
|
409
|
+
|
|
391
410
|
test("no record, an unreadable record and an oversized record post nothing", async () => {
|
|
392
411
|
for (const files of [{} as Record<string, string>, { "/r/review.json": "not json" }, { "/r/review.json": record({ review: "x".repeat(1_100_000) }) }]) {
|
|
393
412
|
const { post, posted } = poster(files);
|
|
@@ -269,6 +269,9 @@ export function riskOf(review: string): ReviewRisk | "unknown" {
|
|
|
269
269
|
return found;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
+
/** The first 12 hex characters of a change set's digest, after its `jcs1-sha256:` or `sha256:` prefix. */
|
|
273
|
+
const shortDigest = (d: string): string => d.replace(/^(jcs1-)?sha256:/, "").slice(0, 12);
|
|
274
|
+
|
|
272
275
|
/** The note's body. The review is the model's text: shown, never trusted, and no HTML comment of it survives. */
|
|
273
276
|
export function reviewNoteBody(o: { review: string; exitCode: number | null; digest: string; instructions: "base" | "none"; head?: string }): string {
|
|
274
277
|
const ok = o.exitCode === 0;
|
|
@@ -277,7 +280,7 @@ export function reviewNoteBody(o: { review: string; exitCode: number | null; dig
|
|
|
277
280
|
const lines = [
|
|
278
281
|
// Ours, and first: the review's own `<!--` is escaped below, so no later marker of this kind is the model's.
|
|
279
282
|
...(o.head !== undefined ? [reviewResultMarker(o.head, risk), ""] : []),
|
|
280
|
-
`### Review of change set \`${o.digest
|
|
283
|
+
`### Review of change set \`${shortDigest(o.digest)}\``,
|
|
281
284
|
"",
|
|
282
285
|
`Risk: **${risk}**. A model compared the title and description with the change set. This note approves nothing and gates nothing.`,
|
|
283
286
|
];
|
|
@@ -528,7 +531,7 @@ export function readReviewRecord(text: string): ReviewRecord | undefined {
|
|
|
528
531
|
const r = v as Record<string, unknown>;
|
|
529
532
|
if (typeof r.review !== "string") return undefined;
|
|
530
533
|
const exitCode = Number.isInteger(r.exitCode) ? (r.exitCode as number) : null;
|
|
531
|
-
const digest = typeof r.digest === "string" && /^sha256:[0-9a-f]{1,128}$/.test(r.digest) ? r.digest : "";
|
|
534
|
+
const digest = typeof r.digest === "string" && /^(jcs1-)?sha256:[0-9a-f]{1,128}$/.test(r.digest) ? r.digest : "";
|
|
532
535
|
return {
|
|
533
536
|
review: r.review,
|
|
534
537
|
exitCode,
|
package/src/op/gate.ts
CHANGED
|
@@ -1095,11 +1095,16 @@ export async function evaluateGate(port: GateLedgerPort, input: GateCheckInput):
|
|
|
1095
1095
|
* plan (#2300) gets `--plan <digest>` too (#2832), so the line approves the
|
|
1096
1096
|
* plan the reader was shown and not whatever is pending by the time they run
|
|
1097
1097
|
* it.
|
|
1098
|
+
*
|
|
1099
|
+
* `target` fills a product's `{target}` (#4574) where no environment does,
|
|
1100
|
+
* such as a wave's run target ({@link waveApproveTarget}). chant's own line
|
|
1101
|
+
* leaves it out: `chant approve` names the op and the gate.
|
|
1098
1102
|
*/
|
|
1099
|
-
export function approveCommand(op: string, gate: string, environment?: string, planDigest?: string, sealed = false): string {
|
|
1103
|
+
export function approveCommand(op: string, gate: string, environment?: string, planDigest?: string, sealed = false, target?: string): string {
|
|
1100
1104
|
// #4550: under a product's words (its bin set them), the product's approve line.
|
|
1101
1105
|
const words = activeProductWords();
|
|
1102
|
-
|
|
1106
|
+
const named = environment ?? target;
|
|
1107
|
+
if (!isChantWords(words)) return approveLine(words, { op, gate, digest: planDigest ?? "", sign: sealed, ...(named !== undefined ? { target: named } : {}) });
|
|
1103
1108
|
return `chant approve ${op} ${gate}` +
|
|
1104
1109
|
(environment === undefined ? "" : ` --env ${environment}`) +
|
|
1105
1110
|
(planDigest === undefined ? "" : ` --plan ${planDigest}`) +
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4574: under a product's words, a waiting wave's approve line fills
|
|
3
|
+
* `{target}`: the run's target for a wave of one run, the wave's name for a
|
|
4
|
+
* wave of several. chant's own line is what it was.
|
|
5
|
+
*/
|
|
6
|
+
import { afterEach, describe, expect, test } from "vitest";
|
|
7
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { assertProductWords, setActiveProductWords } from "../ci-product-words";
|
|
11
|
+
import { waveApproveTarget, type OpWavesSpec } from "./op-waves";
|
|
12
|
+
import { runOpWave, type OpWaveExec, type OpWaveShowAtBase } from "./op-waves-run";
|
|
13
|
+
import { approveCommand, memoryGateLedgerPort } from "./gate";
|
|
14
|
+
import { opWaveNotifyFields } from "./op-waves-notify";
|
|
15
|
+
|
|
16
|
+
const YODEL = assertProductWords({
|
|
17
|
+
product: "yodel",
|
|
18
|
+
noun: ["environment", "environments"],
|
|
19
|
+
approve: "yodel approve {target} --plan {digest} {sign}",
|
|
20
|
+
override: "yodel override {target} --rule {rule} --reason <text>",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const spec: OpWavesSpec = {
|
|
24
|
+
name: "yodel-apply",
|
|
25
|
+
op: "migrate-dev",
|
|
26
|
+
plan: ["tool", "plan", "{target}", "--out", "{plan}"],
|
|
27
|
+
apply: ["tool", "apply", "{target}", "--plan", "{plan}"],
|
|
28
|
+
waves: [
|
|
29
|
+
{ name: "dev", runs: [{ target: "dev" }], gate: "always" },
|
|
30
|
+
{ name: "prod", runs: [{ target: "prod/acme" }, { target: "prod/beta" }], gate: "always" },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const digest = (n: string) => `sha256:${n.repeat(64)}`;
|
|
35
|
+
|
|
36
|
+
function harness() {
|
|
37
|
+
const cwd = mkdtempSync(join(tmpdir(), "op-waves-target-"));
|
|
38
|
+
const exec: OpWaveExec = (argv, dir) => {
|
|
39
|
+
if (argv[1] === "plan") writeFileSync(join(dir, argv[4]!), JSON.stringify({ planDigest: digest(argv[2] === "dev" ? "a" : argv[2] === "prod/acme" ? "b" : "c") }));
|
|
40
|
+
return 0;
|
|
41
|
+
};
|
|
42
|
+
const show: OpWaveShowAtBase = () => ({ sha: "b".repeat(40), text: JSON.stringify(spec) });
|
|
43
|
+
return { cwd, exec, show, done: () => rmSync(cwd, { recursive: true, force: true }) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function waiting(wave: number) {
|
|
47
|
+
const h = harness();
|
|
48
|
+
const lines: string[] = [];
|
|
49
|
+
const result = await runOpWave({ spec, specFile: "waves.json", wave, cwd: h.cwd, exec: h.exec, show: h.show, gates: memoryGateLedgerPort(), log: (l) => lines.push(l) });
|
|
50
|
+
h.done();
|
|
51
|
+
expect(result.exitCode).toBe(3);
|
|
52
|
+
return { result, said: lines.find((l) => l.startsWith(`Nothing in wave ${wave} or after it ran.`)) };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
setActiveProductWords(undefined);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe("a waiting wave's approve line names its target (#4574)", () => {
|
|
60
|
+
test("a wave of one run names the run's target under a product's words", async () => {
|
|
61
|
+
setActiveProductWords(YODEL);
|
|
62
|
+
const { result, said } = await waiting(1);
|
|
63
|
+
const d = result.decision!.digest;
|
|
64
|
+
expect(result.decision!.approve).toBe(`yodel approve dev --plan ${d}`);
|
|
65
|
+
expect(said).toBe(`Nothing in wave 1 or after it ran. Read the plans, then approve: yodel approve dev --plan ${d} (with --resume, the approval also starts this job again)`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("a wave of several runs names the wave, approved once for its set digest", async () => {
|
|
69
|
+
setActiveProductWords(YODEL);
|
|
70
|
+
const { result } = await waiting(2);
|
|
71
|
+
expect(result.decision!.approve).toBe(`yodel approve prod --plan ${result.decision!.digest}`);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("chant's own words keep chant's line", async () => {
|
|
75
|
+
const one = await waiting(1);
|
|
76
|
+
expect(one.result.decision!.approve).toBe(`chant approve yodel-apply ${one.result.decision!.gate} --plan ${one.result.decision!.digest}`);
|
|
77
|
+
const several = await waiting(2);
|
|
78
|
+
expect(several.result.decision!.approve).toBe(`chant approve yodel-apply ${several.result.decision!.gate} --plan ${several.result.decision!.digest}`);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("the notify fallback names the same target", () => {
|
|
82
|
+
setActiveProductWords(YODEL);
|
|
83
|
+
const decision = { wave: 1, name: "dev", op: "yodel-apply", gate: "yodel-apply-wave-1", policy: "always" as const, approval: "ledger" as const, policySource: "base" as const, base: "b", digest: digest("d"), members: [{ member: "dev", planDigest: digest("a") }], status: "waiting" as const };
|
|
84
|
+
const fields = opWaveNotifyFields(spec, 1, { result: { exitCode: 3, decision, applied: [], failed: [], moved: [], hooks: [] } as never }, {}, YODEL);
|
|
85
|
+
expect(fields!.approve).toMatchObject({ command: `yodel approve dev --plan ${digest("d")}` });
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("approveCommand's target (#4574)", () => {
|
|
90
|
+
test("fills a product's {target}; chant's line leaves it out", () => {
|
|
91
|
+
expect(approveCommand("op", "g", undefined, digest("e"), false, "dev")).toBe(`chant approve op g --plan ${digest("e")}`);
|
|
92
|
+
expect(approveCommand("op", "g", undefined, digest("e"), true, "dev")).toBe(`chant approve op g --plan ${digest("e")} --sign`);
|
|
93
|
+
setActiveProductWords(YODEL);
|
|
94
|
+
expect(approveCommand("op", "g", undefined, digest("e"), false, "dev")).toBe(`yodel approve dev --plan ${digest("e")}`);
|
|
95
|
+
expect(approveCommand("op", "g", undefined, digest("e"), true, "dev")).toBe(`yodel approve dev --plan ${digest("e")} --sign`);
|
|
96
|
+
// A component gate's environment wins, as before.
|
|
97
|
+
expect(approveCommand("op", "g", "prod", digest("e"), false, "dev")).toBe(`yodel approve prod --plan ${digest("e")}`);
|
|
98
|
+
// With no target the line has no doubled space.
|
|
99
|
+
expect(approveCommand("op", "g", undefined, digest("e"))).toBe(`yodel approve --plan ${digest("e")}`);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("waveApproveTarget: the one run's target, else the wave's name", () => {
|
|
103
|
+
expect(waveApproveTarget("dev", ["dev"])).toBe("dev");
|
|
104
|
+
expect(waveApproveTarget("prod", ["prod/acme"])).toBe("prod/acme");
|
|
105
|
+
expect(waveApproveTarget("prod", ["prod/acme", "prod/beta"])).toBe("prod");
|
|
106
|
+
expect(waveApproveTarget("discover", [])).toBe("discover");
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -24,7 +24,7 @@ import { activeProductWords, isChantWords, notifyWaveLabel, type CiProductWords
|
|
|
24
24
|
import { productNotifySource, productSendOptions } from "../notify-product";
|
|
25
25
|
import { CHANT_EXIT } from "../exit-codes";
|
|
26
26
|
import { approveCommand } from "./gate";
|
|
27
|
-
import type
|
|
27
|
+
import { waveApproveTarget, type OpWavesSpec } from "./op-waves";
|
|
28
28
|
import type { RunOpWaveResult } from "./op-waves-run";
|
|
29
29
|
|
|
30
30
|
/** How the job ended: the wave's result, or the error that stopped it. */
|
|
@@ -66,7 +66,7 @@ export function opWaveNotifyFields(
|
|
|
66
66
|
status: "waiting",
|
|
67
67
|
summary: `${label} waits for an approval`,
|
|
68
68
|
targets: decision.members.map((m) => m.member),
|
|
69
|
-
approve: { command: decision.approve ?? approveCommand(decision.op, decision.gate, undefined, decision.digest), ...chantApprove(words, decision), ...review },
|
|
69
|
+
approve: { command: decision.approve ?? approveCommand(decision.op, decision.gate, undefined, decision.digest, false, waveApproveTarget(decision.name, decision.members.map((m) => m.member))), ...chantApprove(words, decision), ...review },
|
|
70
70
|
...(decision.heldOn
|
|
71
71
|
? { reason: `held on ${decision.heldOn.op} / ${decision.heldOn.gate} by ${decision.heldOn.hook}` }
|
|
72
72
|
: decision.heldBy?.length
|
package/src/op/op-waves-run.ts
CHANGED
|
@@ -154,6 +154,7 @@ import {
|
|
|
154
154
|
type OpWavesSpec,
|
|
155
155
|
OP_LEDGER_NAME,
|
|
156
156
|
opWavesInvolvedProblems,
|
|
157
|
+
waveApproveTarget,
|
|
157
158
|
} from "./op-waves";
|
|
158
159
|
import {
|
|
159
160
|
OP_WAVE_PENDING_RESERVED,
|
|
@@ -1512,7 +1513,7 @@ async function runHooks(
|
|
|
1512
1513
|
let hold = first;
|
|
1513
1514
|
const approved: OpWaveHeldOnApproval[] = [];
|
|
1514
1515
|
for (;;) {
|
|
1515
|
-
const held = await settleOtherGate(ctx, hold);
|
|
1516
|
+
const held = await settleOtherGate(ctx, hold, runs);
|
|
1516
1517
|
if (held.status === "waiting") {
|
|
1517
1518
|
if (approved.length > 0) held.after = approved;
|
|
1518
1519
|
back.waitingOn ??= held;
|
|
@@ -1698,7 +1699,7 @@ async function finishHeldGate(ctx: WaveContext, hold: OtherGateHold, spent: Appl
|
|
|
1698
1699
|
* under the wave's approval mode (`pr-review` counts the ledger alone, since
|
|
1699
1700
|
* no review planned that digest), else a pending fact for it.
|
|
1700
1701
|
*/
|
|
1701
|
-
async function settleOtherGate(ctx: WaveContext, hold: OtherGateHold): Promise<OpWaveHeldOn> {
|
|
1702
|
+
async function settleOtherGate(ctx: WaveContext, hold: OtherGateHold, runs: readonly OpWaveRun[]): Promise<OpWaveHeldOn> {
|
|
1702
1703
|
const { spec, k, wave, log } = ctx;
|
|
1703
1704
|
const rules = ctx.gateRule;
|
|
1704
1705
|
const op = hold.request.op ?? spec.name;
|
|
@@ -1730,7 +1731,9 @@ async function settleOtherGate(ctx: WaveContext, hold: OtherGateHold): Promise<O
|
|
|
1730
1731
|
const base = { op, gate: hold.request.gate, digest: hold.request.digest, hook: hold.label };
|
|
1731
1732
|
logRefused(log, `${op} / ${hold.request.gate}`, check);
|
|
1732
1733
|
if (check.satisfied) return { ...base, status: "approved", approvedBy: check.resolution.resolvedBy, approvedAt: check.resolution.timestamp };
|
|
1733
|
-
|
|
1734
|
+
// #4574: a per-run hook's hold names its run; else the wave's target, as the wave's own gate does.
|
|
1735
|
+
const target = hold.target ?? waveApproveTarget(wave.name, runs.map((r) => r.target));
|
|
1736
|
+
const approve = approveCommand(op, hold.request.gate, undefined, hold.request.digest, mode === "sealed", target);
|
|
1734
1737
|
log(`wave ${k} (${wave.name}) waits on ${op} / ${hold.request.gate}, which ${hold.label} holds it on: nobody approved ${hold.request.digest}. Approve: ${approve}`);
|
|
1735
1738
|
return {
|
|
1736
1739
|
...base,
|
|
@@ -2962,6 +2965,8 @@ async function settleGate(options: RunOpWaveOptions, ctx: WaveContext, decision:
|
|
|
2962
2965
|
if (decision.quorum?.length) return settleQuorumGate(options, ctx, decision, decision.quorum);
|
|
2963
2966
|
const { spec, k, wave, cwd } = ctx;
|
|
2964
2967
|
const { gate, digest, approval, base, policy, members } = decision;
|
|
2968
|
+
// #4574: the run target a product's approve line names.
|
|
2969
|
+
const target = waveApproveTarget(wave.name, members.map((m) => m.member));
|
|
2965
2970
|
const { ledger, port } = await gatePort(options, cwd, gate, approval, base);
|
|
2966
2971
|
const now = options.now ?? new Date().toISOString();
|
|
2967
2972
|
// #3784: under the spend rule at base, an approval a wave already applied under counts for nothing.
|
|
@@ -3024,7 +3029,7 @@ async function settleGate(options: RunOpWaveOptions, ctx: WaveContext, decision:
|
|
|
3024
3029
|
}
|
|
3025
3030
|
ctx.log(`wave ${k} (${wave.name}): the pull request's approval does not cover it (${covered.reason}), so it waits at its own gate ${gate}`);
|
|
3026
3031
|
decision.status = "waiting";
|
|
3027
|
-
decision.approve = approveCommand(spec.name, gate, undefined, digest);
|
|
3032
|
+
decision.approve = approveCommand(spec.name, gate, undefined, digest, false, target);
|
|
3028
3033
|
return;
|
|
3029
3034
|
}
|
|
3030
3035
|
if (approval === "pr-review") {
|
|
@@ -3039,11 +3044,11 @@ async function settleGate(options: RunOpWaveOptions, ctx: WaveContext, decision:
|
|
|
3039
3044
|
return;
|
|
3040
3045
|
}
|
|
3041
3046
|
decision.status = "waiting";
|
|
3042
|
-
decision.approve = approveCommand(spec.name, gate, undefined, digest);
|
|
3047
|
+
decision.approve = approveCommand(spec.name, gate, undefined, digest, false, target);
|
|
3043
3048
|
return;
|
|
3044
3049
|
}
|
|
3045
3050
|
decision.status = "waiting";
|
|
3046
|
-
decision.approve = approveCommand(spec.name, gate, undefined, digest, approval === "sealed");
|
|
3051
|
+
decision.approve = approveCommand(spec.name, gate, undefined, digest, approval === "sealed", target);
|
|
3047
3052
|
}
|
|
3048
3053
|
|
|
3049
3054
|
/**
|
|
@@ -3252,7 +3257,7 @@ async function settleQuorumGate(options: RunOpWaveOptions, ctx: WaveContext, dec
|
|
|
3252
3257
|
log(`${label}: the approval rules at ${base.slice(0, 12)} are not met (${quorumWaiting(check.quorum.rules)}), so it waits for more approvals of ${digest}`);
|
|
3253
3258
|
}
|
|
3254
3259
|
decision.status = "waiting";
|
|
3255
|
-
decision.approve = approveCommand(spec.name, gate, undefined, digest, approval === "sealed" || rules.some(ruleNeedsProof));
|
|
3260
|
+
decision.approve = approveCommand(spec.name, gate, undefined, digest, approval === "sealed" || rules.some(ruleNeedsProof), waveApproveTarget(wave.name, members.map((m) => m.member)));
|
|
3256
3261
|
}
|
|
3257
3262
|
|
|
3258
3263
|
/**
|
package/src/op/op-waves.ts
CHANGED
|
@@ -181,6 +181,18 @@ export function opWavePointAt(spec: Pick<OpWavesSpec, "point" | "waves">, name:
|
|
|
181
181
|
return opWavePointOf(wave?.point ?? spec.point);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* What a waiting wave's approve line names as `{target}` under a product's
|
|
186
|
+
* words (#4574): the run's target when the wave has one run, else the
|
|
187
|
+
* wave's name. A wave of several runs is approved once, for its set digest
|
|
188
|
+
* over all of them, and a product names such a wave by what they share:
|
|
189
|
+
* sql-yodeler names a tenant set's wave by its environment, which `yodel
|
|
190
|
+
* approve <env>` takes.
|
|
191
|
+
*/
|
|
192
|
+
export function waveApproveTarget(name: string, targets: readonly string[]): string {
|
|
193
|
+
return targets.length === 1 ? targets[0]! : name;
|
|
194
|
+
}
|
|
195
|
+
|
|
184
196
|
export const OP_WAVE_HOOK_FAILURES: readonly OpWaveHookFailure[] = ["fail", "approve"];
|
|
185
197
|
|
|
186
198
|
/** One stage hook (#3762): a command run before or after a wave's plan or apply. */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** #4723: the commit job asks the forge which branch a pull request merges into, outside pr-forge.ts's bundle. */
|
|
2
|
+
import { describe, expect, test } from "vitest";
|
|
3
|
+
import { pullRequestBaseFromEnv } from "./pr-forge-base";
|
|
4
|
+
|
|
5
|
+
function fake(body: unknown, ok = true) {
|
|
6
|
+
const calls: Array<{ url: string; headers: Record<string, string> }> = [];
|
|
7
|
+
const f = async (url: string, init: { headers: Record<string, string> }) => {
|
|
8
|
+
calls.push({ url, headers: init.headers });
|
|
9
|
+
return { ok, json: async () => body };
|
|
10
|
+
};
|
|
11
|
+
return { f, calls };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe("pullRequestBaseFromEnv (#4723)", () => {
|
|
15
|
+
test("GitHub: the pull request's base.ref, with the job's token", async () => {
|
|
16
|
+
const { f, calls } = fake({ base: { ref: "main" } });
|
|
17
|
+
const base = pullRequestBaseFromEnv("github", { GITHUB_REPOSITORY: "acme/infra", GITHUB_TOKEN: "ghs_x" }, f)!;
|
|
18
|
+
expect(await base(7)).toBe("main");
|
|
19
|
+
expect(calls[0]).toEqual({ url: "https://api.github.com/repos/acme/infra/pulls/7", headers: { authorization: "Bearer ghs_x", accept: "application/vnd.github+json", "user-agent": "chant" } });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("Forgejo needs its API root; GitLab reads target_branch", async () => {
|
|
23
|
+
expect(pullRequestBaseFromEnv("forgejo", { GITHUB_REPOSITORY: "acme/infra", GITHUB_TOKEN: "t" })).toBeUndefined();
|
|
24
|
+
const fj = fake({ base: { ref: "develop" } });
|
|
25
|
+
expect(await pullRequestBaseFromEnv("forgejo", { GITHUB_REPOSITORY: "acme/infra", GITHUB_TOKEN: "t", GITHUB_API_URL: "https://fj.test/api/v1/" }, fj.f)!(3)).toBe("develop");
|
|
26
|
+
expect(fj.calls[0]!.url).toBe("https://fj.test/api/v1/repos/acme/infra/pulls/3");
|
|
27
|
+
const gl = fake({ target_branch: "main" });
|
|
28
|
+
expect(await pullRequestBaseFromEnv("gitlab", { CI_API_V4_URL: "https://gl.test/api/v4", CI_PROJECT_ID: "12", CHANT_FORGE_TOKEN: "glpat" }, gl.f)!(9)).toBe("main");
|
|
29
|
+
expect(gl.calls[0]).toEqual({ url: "https://gl.test/api/v4/projects/12/merge_requests/9", headers: { "private-token": "glpat" } });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("no token, a refused read or a body without a base is undefined", async () => {
|
|
33
|
+
expect(pullRequestBaseFromEnv("github", { GITHUB_REPOSITORY: "acme/infra" })).toBeUndefined();
|
|
34
|
+
expect(await pullRequestBaseFromEnv("github", { GITHUB_REPOSITORY: "a/b", GITHUB_TOKEN: "t" }, fake({}, false).f)!(1)).toBeUndefined();
|
|
35
|
+
expect(await pullRequestBaseFromEnv("github", { GITHUB_REPOSITORY: "a/b", GITHUB_TOKEN: "t" }, fake({ base: {} }).f)!(1)).toBeUndefined();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The branch a pull request merges into (#4723), read from the forge for the
|
|
3
|
+
* commit job's base merge. It sits outside ./pr-forge.ts so the pull-request
|
|
4
|
+
* loop's bundle, which carries pr-forge.ts under a ruled size ceiling, does
|
|
5
|
+
* not grow for a job it never runs. It reads the job's environment the way
|
|
6
|
+
* `forgeFromEnv` does.
|
|
7
|
+
*/
|
|
8
|
+
import type { ForgeKind } from "./pr-forge";
|
|
9
|
+
|
|
10
|
+
type Fetch = (url: string, init: { headers: Record<string, string> }) => Promise<{ ok: boolean; json(): Promise<unknown> }>;
|
|
11
|
+
|
|
12
|
+
/** `(pr) => base branch`, or undefined when the job's environment names no forge to ask. A failed read is undefined, which the commit job refuses by name. */
|
|
13
|
+
export function pullRequestBaseFromEnv(kind: ForgeKind, env: Record<string, string | undefined> = process.env, fetchImpl: Fetch = (url, init) => fetch(url, init)): ((pr: number) => Promise<string | undefined>) | undefined {
|
|
14
|
+
const read = async (url: string, headers: Record<string, string>, pick: (body: Record<string, unknown>) => unknown): Promise<string | undefined> => {
|
|
15
|
+
try {
|
|
16
|
+
const res = await fetchImpl(url, { headers });
|
|
17
|
+
if (!res.ok) return undefined;
|
|
18
|
+
const body = await res.json();
|
|
19
|
+
const v = body && typeof body === "object" ? pick(body as Record<string, unknown>) : undefined;
|
|
20
|
+
return typeof v === "string" && v !== "" ? v : undefined;
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (kind === "gitlab") {
|
|
26
|
+
const token = env.CHANT_FORGE_TOKEN ?? env.GITLAB_TOKEN;
|
|
27
|
+
if (!env.CI_API_V4_URL || !env.CI_PROJECT_ID || !token) return undefined;
|
|
28
|
+
const root = `${env.CI_API_V4_URL.replace(/\/+$/, "")}/projects/${encodeURIComponent(env.CI_PROJECT_ID)}`;
|
|
29
|
+
return (pr) => read(`${root}/merge_requests/${pr}`, { "private-token": token }, (b) => b.target_branch);
|
|
30
|
+
}
|
|
31
|
+
const token = env.CHANT_FORGE_TOKEN ?? env.GITHUB_TOKEN ?? env.GH_TOKEN;
|
|
32
|
+
const api = env.GITHUB_API_URL ?? (kind === "github" ? "https://api.github.com" : undefined);
|
|
33
|
+
if (!env.GITHUB_REPOSITORY || !token || !api) return undefined;
|
|
34
|
+
const headers: Record<string, string> = kind === "github" ? { authorization: `Bearer ${token}`, accept: "application/vnd.github+json", "user-agent": "chant" } : { authorization: `token ${token}`, accept: "application/json" };
|
|
35
|
+
return (pr) => read(`${api.replace(/\/+$/, "")}/repos/${env.GITHUB_REPOSITORY}/pulls/${pr}`, headers, (b) => (b.base && typeof b.base === "object" ? (b.base as { ref?: unknown }).ref : undefined));
|
|
36
|
+
}
|
package/src/release-floors.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
defaults:
|
|
12
|
+
run:
|
|
13
|
+
working-directory: packages/app
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build
|
|
24
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
25
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
26
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --yes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
node-version: 24
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
22
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
23
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --yes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
defaults:
|
|
12
|
+
run:
|
|
13
|
+
working-directory: packages/app
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build
|
|
24
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
25
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
26
|
+
- run: npx chant release verify "${GITHUB_REF_NAME#release/}"
|
|
27
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --require-provenance --yes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
node-version: 24
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
22
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
23
|
+
- run: npx chant release verify "${GITHUB_REF_NAME#release/}"
|
|
24
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --require-provenance --yes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
defaults:
|
|
12
|
+
run:
|
|
13
|
+
working-directory: packages/app
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build
|
|
24
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
25
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
26
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --yes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
node-version: 24
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
22
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
23
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --yes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
defaults:
|
|
12
|
+
run:
|
|
13
|
+
working-directory: packages/app
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
19
|
+
with:
|
|
20
|
+
node-version: 24
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build
|
|
24
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
25
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
26
|
+
- run: npx chant release verify "${GITHUB_REF_NAME#release/}"
|
|
27
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --require-provenance --yes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: chant release publish
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["release/**"]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
16
|
+
with:
|
|
17
|
+
node-version: 24
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
22
|
+
- run: git fetch origin chant/lifecycle:chant/lifecycle
|
|
23
|
+
- run: npx chant release verify "${GITHUB_REF_NAME#release/}"
|
|
24
|
+
- run: npx chant release publish "${GITHUB_REF_NAME#release/}" --require-provenance --yes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
chant-release-publish:
|
|
2
|
+
rules:
|
|
3
|
+
- if: $CI_COMMIT_TAG =~ /^release\//
|
|
4
|
+
id_tokens:
|
|
5
|
+
SIGSTORE_ID_TOKEN:
|
|
6
|
+
aud: sigstore
|
|
7
|
+
script:
|
|
8
|
+
- cd packages/app
|
|
9
|
+
- npm ci
|
|
10
|
+
- npm run build
|
|
11
|
+
- git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
12
|
+
- git fetch origin chant/lifecycle:chant/lifecycle
|
|
13
|
+
- npx chant release publish "${CI_COMMIT_TAG#release/}" --yes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
chant-release-publish:
|
|
2
|
+
rules:
|
|
3
|
+
- if: $CI_COMMIT_TAG =~ /^release\//
|
|
4
|
+
id_tokens:
|
|
5
|
+
SIGSTORE_ID_TOKEN:
|
|
6
|
+
aud: sigstore
|
|
7
|
+
script:
|
|
8
|
+
- npm ci
|
|
9
|
+
- npm run build
|
|
10
|
+
- git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
11
|
+
- git fetch origin chant/lifecycle:chant/lifecycle
|
|
12
|
+
- npx chant release publish "${CI_COMMIT_TAG#release/}" --yes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
chant-release-publish:
|
|
2
|
+
rules:
|
|
3
|
+
- if: $CI_COMMIT_TAG =~ /^release\//
|
|
4
|
+
id_tokens:
|
|
5
|
+
SIGSTORE_ID_TOKEN:
|
|
6
|
+
aud: sigstore
|
|
7
|
+
script:
|
|
8
|
+
- cd packages/app
|
|
9
|
+
- npm ci
|
|
10
|
+
- npm run build
|
|
11
|
+
- git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
|
|
12
|
+
- git fetch origin chant/lifecycle:chant/lifecycle
|
|
13
|
+
- npx chant release verify "${CI_COMMIT_TAG#release/}"
|
|
14
|
+
- npx chant release publish "${CI_COMMIT_TAG#release/}" --require-provenance --yes
|