@intentius/chant 0.124.70 → 0.124.71
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 +297 -0
- package/dist/ci-commit.d.ts.map +1 -0
- package/dist/ci-commit.js +696 -0
- 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/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 +142 -0
- 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 +46 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -0
- package/dist/lexicon.d.ts +37 -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 +103 -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 +139 -0
- package/dist/lifecycle/release-publish.d.ts +2 -0
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.d.ts +4 -4
- 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 +23 -0
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +203 -12
- 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 +857 -0
- package/src/ci-product-words.ts +6 -2
- package/src/cli/handlers/approve.ts +6 -2
- package/src/cli/handlers/commit.ts +152 -0
- 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 +24 -0
- package/src/lexicon.ts +56 -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 +101 -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 +175 -0
- package/src/lifecycle/release-publish.ts +2 -0
- 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 +151 -0
- package/src/workspace/release-workflow.ts +270 -12
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** #4656: `chant release workflow` renders the release pipeline from the `release` block. */
|
|
2
|
+
import { describe, expect, test } from "vitest";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { parseYAML } from "../yaml";
|
|
6
|
+
import { renderReleaseWorkflow, RELEASE_DIGESTS_FILE, type ReleaseWorkflowInput } from "./release-workflow";
|
|
7
|
+
import type { SecurityGroup } from "./security";
|
|
8
|
+
|
|
9
|
+
const FIXTURES = join(__dirname, "__fixtures__", "release-workflow");
|
|
10
|
+
const FORGES = ["github", "forgejo", "gitlab"] as const;
|
|
11
|
+
const SECURE = new Set<SecurityGroup>(["supply-chain", "verified-releases"]);
|
|
12
|
+
|
|
13
|
+
describe("a config with only publish (#4656)", () => {
|
|
14
|
+
test("renders, byte for byte, the file chant 0.124.70 wrote, on every forge, with and without the security groups and a workspace root", () => {
|
|
15
|
+
for (const forge of FORGES) {
|
|
16
|
+
for (const [name, groups] of [["plain", new Set<SecurityGroup>()], ["secure", SECURE]] as const) {
|
|
17
|
+
for (const root of [".", "packages/app"]) {
|
|
18
|
+
const file = `${forge}-${name}${root === "." ? "" : "-member"}.yml`;
|
|
19
|
+
expect(renderReleaseWorkflow({ forge, groups, workspaceRoot: root }), file).toBe(readFileSync(join(FIXTURES, file), "utf-8"));
|
|
20
|
+
// An empty block, or a tag trigger, is the same file.
|
|
21
|
+
expect(renderReleaseWorkflow({ forge, groups, workspaceRoot: root, pipeline: { trigger: "tag" } }), file).toBe(readFileSync(join(FIXTURES, file), "utf-8"));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
type GhJob = { needs?: string | string[]; outputs?: Record<string, string>; env?: Record<string, string>; steps: Array<{ id?: string; uses?: string; run?: string; with?: Record<string, unknown> }> };
|
|
29
|
+
type GhDoc = { on: Record<string, unknown>; env?: Record<string, string>; permissions: Record<string, string>; jobs: Record<string, GhJob> };
|
|
30
|
+
const runs = (job: GhJob): string[] => job.steps.filter((s) => s.run).map((s) => s.run!.trim());
|
|
31
|
+
|
|
32
|
+
const dispatch = (forge: (typeof FORGES)[number], over: Partial<ReleaseWorkflowInput> = {}): string =>
|
|
33
|
+
renderReleaseWorkflow({ forge, groups: new Set(), pipeline: { trigger: "dispatch", build: "npm run build", after: ["npm run announce"] }, ...over });
|
|
34
|
+
|
|
35
|
+
describe("a dispatched release (#4656)", () => {
|
|
36
|
+
for (const forge of ["github", "forgejo"] as const) {
|
|
37
|
+
test(`${forge}: gate, cut, publish and post-release, started by hand with a label, and no tag before the gate`, () => {
|
|
38
|
+
const doc = parseYAML(dispatch(forge)) as GhDoc;
|
|
39
|
+
expect(Object.keys(doc.on)).toEqual(["workflow_dispatch"]);
|
|
40
|
+
expect(doc.env).toEqual({ CHANT_RELEASE_LABEL: "${{ inputs.label }}" });
|
|
41
|
+
expect(Object.keys(doc.jobs)).toEqual(["gate", "cut", "publish", "after-release"]);
|
|
42
|
+
const { gate, cut, publish } = doc.jobs as Record<string, GhJob>;
|
|
43
|
+
|
|
44
|
+
expect(gate!.outputs).toEqual({ commit: "${{ steps.green.outputs.commit }}" });
|
|
45
|
+
const green = gate!.steps.find((s) => s.id === "green")!.run!;
|
|
46
|
+
expect(green).toContain('npx chant ci last-green --from "$GITHUB_SHA" --json');
|
|
47
|
+
expect(green).toContain('echo "commit=$commit" >> "$GITHUB_OUTPUT"');
|
|
48
|
+
expect(green).not.toContain("is not green");
|
|
49
|
+
// Nothing in the gate tags or cuts.
|
|
50
|
+
expect(runs(gate!).join("\n")).not.toMatch(/release cut|git push|git tag/);
|
|
51
|
+
|
|
52
|
+
expect(cut!.needs).toBe("gate");
|
|
53
|
+
expect(cut!.env).toEqual({ CHANT_RELEASE_COMMIT: "${{ needs.gate.outputs.commit }}" });
|
|
54
|
+
expect(cut!.steps[0]!.with).toEqual({ ref: "${{ needs.gate.outputs.commit }}", "fetch-depth": 0 });
|
|
55
|
+
const cutRun = runs(cut!).join("\n");
|
|
56
|
+
expect(cutRun).toContain(`npx chant release cut "$CHANT_RELEASE_LABEL" --at "$CHANT_RELEASE_COMMIT" --yes --build 'npm run build' --json > "$RUNNER_TEMP/chant-cut.json"`);
|
|
57
|
+
expect(cutRun).toContain('git push origin "refs/tags/$tag"');
|
|
58
|
+
// The label reaches the shell as a variable, never spliced into a run line.
|
|
59
|
+
expect(dispatch(forge)).not.toMatch(/run:.*\$\{\{ inputs\.label \}\}/);
|
|
60
|
+
|
|
61
|
+
expect(publish!.needs).toEqual(["gate", "cut"]);
|
|
62
|
+
expect(runs(publish!)).toEqual([
|
|
63
|
+
"npm ci",
|
|
64
|
+
"git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'",
|
|
65
|
+
"git fetch origin chant/lifecycle:chant/lifecycle",
|
|
66
|
+
"npm run build",
|
|
67
|
+
'npx chant release publish "$CHANT_RELEASE_LABEL" --yes',
|
|
68
|
+
]);
|
|
69
|
+
expect(runs(doc.jobs["after-release"]!)).toEqual(["npm ci", "npm run announce"]);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
test("gate head refuses a dispatched commit that is not green; a lane is passed to the gate and the cut", () => {
|
|
74
|
+
const doc = parseYAML(renderReleaseWorkflow({ forge: "github", groups: new Set(), lane: "fast", pipeline: { trigger: "dispatch", gate: "head", build: false } })) as GhDoc;
|
|
75
|
+
const green = doc.jobs.gate!.steps.find((s) => s.id === "green")!.run!;
|
|
76
|
+
expect(green).toContain("--lane fast");
|
|
77
|
+
expect(green).toContain('if [ "$commit" != "$GITHUB_SHA" ]');
|
|
78
|
+
const cutRun = runs(doc.jobs.cut!).join("\n");
|
|
79
|
+
expect(cutRun).toContain("--lane fast");
|
|
80
|
+
expect(cutRun).not.toContain("--build");
|
|
81
|
+
expect(runs(doc.jobs.publish!)).not.toContain("npm run build");
|
|
82
|
+
expect(doc.jobs["after-release"]).toBeUndefined();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("the security groups still add --require-provenance and release verify, and release images runs before the build", () => {
|
|
86
|
+
const doc = parseYAML(dispatch("github", { groups: SECURE, images: true })) as GhDoc;
|
|
87
|
+
expect(runs(doc.jobs.publish!)).toEqual([
|
|
88
|
+
"npm ci",
|
|
89
|
+
"git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'",
|
|
90
|
+
"git fetch origin chant/lifecycle:chant/lifecycle",
|
|
91
|
+
`npx chant release images "$CHANT_RELEASE_LABEL" -o ${RELEASE_DIGESTS_FILE}`,
|
|
92
|
+
`echo "CHANT_RELEASE_DIGESTS=$PWD/${RELEASE_DIGESTS_FILE}" >> "$GITHUB_ENV"`,
|
|
93
|
+
"npm run build",
|
|
94
|
+
'npx chant release verify "$CHANT_RELEASE_LABEL"',
|
|
95
|
+
'npx chant release publish "$CHANT_RELEASE_LABEL" --require-provenance --yes',
|
|
96
|
+
]);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("gitlab: four jobs chained by needs in the default stage, started with CHANT_RELEASE_LABEL, the commit handed on as a dotenv, pushes with CHANT_RELEASE_TOKEN", () => {
|
|
100
|
+
const doc = parseYAML(dispatch("gitlab", { groups: SECURE, images: true })) as Record<string, { rules: Array<{ if: string }>; needs?: string[]; script: string[]; stage?: string; artifacts?: unknown; id_tokens?: unknown }>;
|
|
101
|
+
expect(Object.keys(doc)).toEqual(["chant-release-gate", "chant-release-cut", "chant-release-publish", "chant-release-after"]);
|
|
102
|
+
for (const job of Object.values(doc)) {
|
|
103
|
+
expect(job.rules).toEqual([{ if: "$CHANT_RELEASE_LABEL && $CI_PIPELINE_SOURCE =~ /^(web|api|trigger)$/" }]);
|
|
104
|
+
expect(job.stage).toBeUndefined();
|
|
105
|
+
}
|
|
106
|
+
expect(doc["chant-release-gate"]!.artifacts).toEqual({ reports: { dotenv: "chant-release-gate.env" } });
|
|
107
|
+
expect(doc["chant-release-gate"]!.script.join("\n")).toContain('--from "$CI_COMMIT_SHA"');
|
|
108
|
+
expect(doc["chant-release-cut"]!.needs).toEqual(["chant-release-gate"]);
|
|
109
|
+
expect(doc["chant-release-cut"]!.script[0]).toBe('git checkout --detach "$CHANT_RELEASE_COMMIT"');
|
|
110
|
+
expect(doc["chant-release-cut"]!.script.join("\n")).toContain("CHANT_RELEASE_TOKEN");
|
|
111
|
+
const publish = doc["chant-release-publish"]!;
|
|
112
|
+
expect(publish.id_tokens).toEqual({ SIGSTORE_ID_TOKEN: { aud: "sigstore" } });
|
|
113
|
+
expect(publish.script.slice(-5)).toEqual([
|
|
114
|
+
`npx chant release images "$CHANT_RELEASE_LABEL" -o ${RELEASE_DIGESTS_FILE}`,
|
|
115
|
+
`export CHANT_RELEASE_DIGESTS="$PWD/${RELEASE_DIGESTS_FILE}"`,
|
|
116
|
+
"npm run build",
|
|
117
|
+
'npx chant release verify "$CHANT_RELEASE_LABEL"',
|
|
118
|
+
'npx chant release publish "$CHANT_RELEASE_LABEL" --require-provenance --yes',
|
|
119
|
+
]);
|
|
120
|
+
expect(doc["chant-release-after"]!.script.at(-1)).toBe("npm run announce");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("a build command with a quote is passed to the cut as one shell word", () => {
|
|
124
|
+
const text = renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { trigger: "dispatch", build: "npm run build -- --label 'x'" } });
|
|
125
|
+
expect(text).toContain(`--build 'npm run build -- --label '\\''x'\\''' --json`);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe("the tag trigger with images or after (#4656)", () => {
|
|
130
|
+
test("release images runs after the ledger fetch and before the build, and after-release follows the publish", () => {
|
|
131
|
+
const doc = parseYAML(renderReleaseWorkflow({ forge: "github", groups: new Set(), images: true, pipeline: { after: ["./notify.sh"] } })) as GhDoc;
|
|
132
|
+
expect(Object.keys(doc.on)).toEqual(["push"]);
|
|
133
|
+
expect(runs(doc.jobs.publish!)).toEqual([
|
|
134
|
+
"npm ci",
|
|
135
|
+
"git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'",
|
|
136
|
+
"git fetch origin chant/lifecycle:chant/lifecycle",
|
|
137
|
+
`npx chant release images "\${GITHUB_REF_NAME#release/}" -o ${RELEASE_DIGESTS_FILE}`,
|
|
138
|
+
`echo "CHANT_RELEASE_DIGESTS=$PWD/${RELEASE_DIGESTS_FILE}" >> "$GITHUB_ENV"`,
|
|
139
|
+
"npm run build",
|
|
140
|
+
'npx chant release publish "${GITHUB_REF_NAME#release/}" --yes',
|
|
141
|
+
]);
|
|
142
|
+
expect(doc.jobs["after-release"]!.needs).toBe("publish");
|
|
143
|
+
expect(runs(doc.jobs["after-release"]!)).toEqual(['echo "CHANT_RELEASE_LABEL=${GITHUB_REF_NAME#release/}" >> "$GITHUB_ENV"', "npm ci", "./notify.sh"]);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("gitlab: the after job needs the publish", () => {
|
|
147
|
+
const doc = parseYAML(renderReleaseWorkflow({ forge: "gitlab", groups: new Set(), pipeline: { after: ["./notify.sh"] } })) as Record<string, { needs?: string[]; script: string[] }>;
|
|
148
|
+
expect(doc["chant-release-after"]!.needs).toEqual(["chant-release-publish"]);
|
|
149
|
+
expect(doc["chant-release-after"]!.script.at(-1)).toBe("./notify.sh");
|
|
150
|
+
});
|
|
151
|
+
});
|
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
* The OIDC permission (`id-token: write`, or GitLab's `id_tokens`) is always
|
|
16
16
|
* there: it costs nothing, and with it what the job uploads carries
|
|
17
17
|
* provenance whether or not the group requires it.
|
|
18
|
+
*
|
|
19
|
+
* `release.workflow` in the root's `chant.config.ts` (#4656) renders the
|
|
20
|
+
* rest of the release from the same file. `trigger: "dispatch"` starts it by
|
|
21
|
+
* hand with a label, and four jobs follow: the gate names the commit to cut
|
|
22
|
+
* (`chant ci last-green`, or the dispatched commit itself under `gate:
|
|
23
|
+
* "head"`), the cut runs `chant release cut <label> --at <commit>` and pushes
|
|
24
|
+
* the release's tag, the publish job publishes it, and the post-release job
|
|
25
|
+
* runs `after`. No tag exists until the gate has passed. With
|
|
26
|
+
* `release.images` (#4657) the publish job builds the images again with
|
|
27
|
+
* `chant release images` before the build. A config with only `publish`
|
|
28
|
+
* renders the tag-triggered file it always did.
|
|
18
29
|
*/
|
|
19
30
|
import { ACTION_PINS, tagComments, usesRef } from "../action-pins";
|
|
20
31
|
import { GENERATED_MARKER } from "../discovery/files";
|
|
@@ -31,6 +42,22 @@ export const RELEASE_WORKFLOW_FILES: Record<ReleaseWorkflowForge, string> = {
|
|
|
31
42
|
gitlab: ".gitlab/chant-release.yml",
|
|
32
43
|
};
|
|
33
44
|
|
|
45
|
+
/** `release.workflow` in `chant.config.ts` (#4656): how the release pipeline starts and what it runs. */
|
|
46
|
+
export interface ReleasePipelineConfig {
|
|
47
|
+
/** `tag` (default): the publish job runs on a `release/**` tag. `dispatch`: the whole release starts by hand with a label. */
|
|
48
|
+
trigger?: "tag" | "dispatch";
|
|
49
|
+
/** 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. */
|
|
50
|
+
gate?: "last-green" | "head";
|
|
51
|
+
/** The command that installs what the build needs. Default `npm ci`. */
|
|
52
|
+
install?: string;
|
|
53
|
+
/** 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`. */
|
|
54
|
+
build?: string | false;
|
|
55
|
+
/** What runs chant. Default `npx chant`. */
|
|
56
|
+
chant?: string;
|
|
57
|
+
/** Shell lines run after the publish, with `CHANT_RELEASE_LABEL` set: steps that need a published release. */
|
|
58
|
+
after?: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
export interface ReleaseWorkflowInput {
|
|
35
62
|
forge: ReleaseWorkflowForge;
|
|
36
63
|
/** The security groups the workspace opts into at its root. */
|
|
@@ -43,6 +70,12 @@ export interface ReleaseWorkflowInput {
|
|
|
43
70
|
chant?: string;
|
|
44
71
|
/** The workspace root relative to the repository root, `.` at the top. */
|
|
45
72
|
workspaceRoot?: string;
|
|
73
|
+
/** `release.workflow` (#4656). A flag above wins over the field it names. */
|
|
74
|
+
pipeline?: ReleasePipelineConfig;
|
|
75
|
+
/** The config declares `release.images` (#4657): the publish job builds them again first. */
|
|
76
|
+
images?: boolean;
|
|
77
|
+
/** `release.lane` (#4692): the gate's green lane. */
|
|
78
|
+
lane?: string;
|
|
46
79
|
}
|
|
47
80
|
|
|
48
81
|
/** The flags `chant release publish` gets under the groups. */
|
|
@@ -50,16 +83,34 @@ export function publishFlags(groups: ReadonlySet<SecurityGroup>): string[] {
|
|
|
50
83
|
return [...(groups.has("supply-chain") ? ["--require-provenance"] : []), "--yes"];
|
|
51
84
|
}
|
|
52
85
|
|
|
86
|
+
/** Where `chant release images` writes the digests the publish job's build reads (#4657). */
|
|
87
|
+
export const RELEASE_DIGESTS_FILE = ".chant/release-digests.json";
|
|
88
|
+
|
|
89
|
+
/** A string as a single-quoted shell word. */
|
|
90
|
+
function sq(s: string): string {
|
|
91
|
+
return `'${s.replaceAll("'", "'\\''")}'`;
|
|
92
|
+
}
|
|
93
|
+
|
|
53
94
|
/** The workflow file's text, without the generated-by header. */
|
|
54
95
|
export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
96
|
+
const p = input.pipeline ?? {};
|
|
97
|
+
const chant = input.chant ?? p.chant ?? "npx chant";
|
|
98
|
+
const install = input.install ?? p.install ?? "npm ci";
|
|
99
|
+
const build = input.build !== undefined ? input.build : p.build === false ? null : (p.build ?? "npm run build");
|
|
58
100
|
const root = input.workspaceRoot && input.workspaceRoot !== "." ? input.workspaceRoot : null;
|
|
59
101
|
const verify = input.groups.has("verified-releases");
|
|
60
102
|
const flags = publishFlags(input.groups).join(" ");
|
|
103
|
+
const after = p.after ?? [];
|
|
104
|
+
const images = input.images === true;
|
|
105
|
+
if (p.trigger === "dispatch") {
|
|
106
|
+
const o = { chant, install, build, root, verify, flags, after, images, gate: p.gate ?? "last-green", ...(input.lane ? { lane: input.lane } : {}) };
|
|
107
|
+
return input.forge === "gitlab" ? renderGitlabDispatch(o) : renderGithubDispatch(o);
|
|
108
|
+
}
|
|
109
|
+
// #4657: the images are built from the release, so chant/lifecycle is fetched before them and the build after.
|
|
110
|
+
const imageLines = (label: string, env: string): string[] => [`${chant} release images ${label} -o ${RELEASE_DIGESTS_FILE}`, env];
|
|
61
111
|
if (input.forge === "gitlab") {
|
|
62
112
|
const label = '"${CI_COMMIT_TAG#release/}"';
|
|
113
|
+
const fetches = [" - git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'", " - git fetch origin chant/lifecycle:chant/lifecycle"];
|
|
63
114
|
const lines = [
|
|
64
115
|
"chant-release-publish:",
|
|
65
116
|
" rules:",
|
|
@@ -70,15 +121,30 @@ export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
|
|
|
70
121
|
" script:",
|
|
71
122
|
...(root ? [` - cd ${root}`] : []),
|
|
72
123
|
` - ${install}`,
|
|
124
|
+
...(images ? [...fetches, ...imageLines(label, `export CHANT_RELEASE_DIGESTS="$PWD/${RELEASE_DIGESTS_FILE}"`).map((l) => ` - ${l}`)] : []),
|
|
73
125
|
...(build ? [` - ${build}`] : []),
|
|
74
|
-
|
|
75
|
-
" - git fetch origin chant/lifecycle:chant/lifecycle",
|
|
126
|
+
...(images ? [] : fetches),
|
|
76
127
|
...(verify ? [` - ${chant} release verify ${label}`] : []),
|
|
77
128
|
` - ${chant} release publish ${label} ${flags}`,
|
|
78
129
|
];
|
|
130
|
+
if (after.length > 0) {
|
|
131
|
+
lines.push(
|
|
132
|
+
"",
|
|
133
|
+
"chant-release-after:",
|
|
134
|
+
" rules:",
|
|
135
|
+
" - if: $CI_COMMIT_TAG =~ /^release\\//",
|
|
136
|
+
" needs: [chant-release-publish]",
|
|
137
|
+
" script:",
|
|
138
|
+
' - export CHANT_RELEASE_LABEL="${CI_COMMIT_TAG#release/}"',
|
|
139
|
+
...(root ? [` - cd ${root}`] : []),
|
|
140
|
+
` - ${install}`,
|
|
141
|
+
...after.map((l) => ` - ${l}`),
|
|
142
|
+
);
|
|
143
|
+
}
|
|
79
144
|
return `${lines.join("\n")}\n`;
|
|
80
145
|
}
|
|
81
146
|
const label = '"${GITHUB_REF_NAME#release/}"';
|
|
147
|
+
const fetches = [" - run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'", " - run: git fetch origin chant/lifecycle:chant/lifecycle"];
|
|
82
148
|
const lines = [
|
|
83
149
|
"name: chant release publish",
|
|
84
150
|
"on:",
|
|
@@ -92,23 +158,200 @@ export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
|
|
|
92
158
|
" runs-on: ubuntu-latest",
|
|
93
159
|
...(root ? [" defaults:", " run:", ` working-directory: ${root}`] : []),
|
|
94
160
|
" steps:",
|
|
161
|
+
...githubSetup(),
|
|
162
|
+
` - run: ${install}`,
|
|
163
|
+
...(images ? [...fetches, ...imageLines(label, `echo "CHANT_RELEASE_DIGESTS=$PWD/${RELEASE_DIGESTS_FILE}" >> "$GITHUB_ENV"`).map((l) => ` - run: ${l}`)] : []),
|
|
164
|
+
...(build ? [` - run: ${build}`] : []),
|
|
165
|
+
...(images ? [] : fetches),
|
|
166
|
+
...(verify ? [` - run: ${chant} release verify ${label}`] : []),
|
|
167
|
+
` - run: ${chant} release publish ${label} ${flags}`,
|
|
168
|
+
];
|
|
169
|
+
if (after.length > 0) {
|
|
170
|
+
lines.push(
|
|
171
|
+
" after-release:",
|
|
172
|
+
" needs: publish",
|
|
173
|
+
" runs-on: ubuntu-latest",
|
|
174
|
+
...(root ? [" defaults:", " run:", ` working-directory: ${root}`] : []),
|
|
175
|
+
" steps:",
|
|
176
|
+
...githubSetup(),
|
|
177
|
+
' - run: echo "CHANT_RELEASE_LABEL=${GITHUB_REF_NAME#release/}" >> "$GITHUB_ENV"',
|
|
178
|
+
` - run: ${install}`,
|
|
179
|
+
...after.map((l) => ` - run: ${l}`),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return tagComments(`${lines.join("\n")}\n`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The checkout and node setup a GitHub or Forgejo job starts with; `ref` checks out that commit. */
|
|
186
|
+
function githubSetup(ref?: string): string[] {
|
|
187
|
+
return [
|
|
95
188
|
` - uses: ${usesRef(ACTION_PINS.checkout4)}`,
|
|
96
189
|
" with:",
|
|
190
|
+
...(ref ? [` ref: ${ref}`] : []),
|
|
97
191
|
" fetch-depth: 0",
|
|
98
192
|
` - uses: ${usesRef(ACTION_PINS.setupNode4)}`,
|
|
99
193
|
" with:",
|
|
100
194
|
" node-version: 24",
|
|
101
195
|
" registry-url: https://registry.npmjs.org",
|
|
102
|
-
` - run: ${install}`,
|
|
103
|
-
...(build ? [` - run: ${build}`] : []),
|
|
104
|
-
" - run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'",
|
|
105
|
-
" - run: git fetch origin chant/lifecycle:chant/lifecycle",
|
|
106
|
-
...(verify ? [` - run: ${chant} release verify ${label}`] : []),
|
|
107
|
-
` - run: ${chant} release publish ${label} ${flags}`,
|
|
108
196
|
];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface DispatchInput {
|
|
200
|
+
chant: string;
|
|
201
|
+
install: string;
|
|
202
|
+
build: string | null;
|
|
203
|
+
root: string | null;
|
|
204
|
+
verify: boolean;
|
|
205
|
+
flags: string;
|
|
206
|
+
after: string[];
|
|
207
|
+
images: boolean;
|
|
208
|
+
gate: "last-green" | "head";
|
|
209
|
+
lane?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** The node one-liner that prints a JSON document's field from stdin, or from the file its argument names. */
|
|
213
|
+
const field = (path: string): string =>
|
|
214
|
+
`node -e 'const f=process.argv[1];const t=f?require("fs").readFileSync(f,"utf8"):require("fs").readFileSync(0,"utf8");const d=JSON.parse(t);process.stdout.write(String(${path}??""))'`;
|
|
215
|
+
|
|
216
|
+
/** 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. */
|
|
217
|
+
function gateScript(o: DispatchInput, dispatched: string): string[] {
|
|
218
|
+
return [
|
|
219
|
+
`commit="$(${o.chant} ci last-green --from "${dispatched}"${o.lane ? ` --lane ${o.lane}` : ""} --json | ${field("d.commit?.sha")})"`,
|
|
220
|
+
`if [ -z "$commit" ]; then echo "no green commit at or below ${dispatched}, so no release is cut" >&2; exit 1; fi`,
|
|
221
|
+
...(o.gate === "head" ? [`if [ "$commit" != "${dispatched}" ]; then echo "${dispatched} is not green (the newest green commit below it is $commit), so no release is cut" >&2; exit 1; fi`] : []),
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The cut's shell: cut the label at the gate's commit, then push the tag the cut made. */
|
|
226
|
+
function cutScript(o: DispatchInput, out: string): string[] {
|
|
227
|
+
return [
|
|
228
|
+
'git config user.name "chant release"',
|
|
229
|
+
'git config user.email "chant-release@localhost"',
|
|
230
|
+
`${o.chant} release cut "$CHANT_RELEASE_LABEL" --at "$CHANT_RELEASE_COMMIT" --yes${o.build ? ` --build ${sq(o.build)}` : ""}${o.lane ? ` --lane ${o.lane}` : ""} --json > ${out}`,
|
|
231
|
+
`tag="$(${field("d.tag?.name")} ${out})"`,
|
|
232
|
+
'if [ -n "$tag" ]; then git push origin "refs/tags/$tag"; fi',
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** GitHub and Forgejo: the release started by hand with a label (#4656). */
|
|
237
|
+
function renderGithubDispatch(o: DispatchInput): string {
|
|
238
|
+
const defaults = o.root ? [" defaults:", " run:", ` working-directory: ${o.root}`] : [];
|
|
239
|
+
const commit = "${{ needs.gate.outputs.commit }}";
|
|
240
|
+
const fetches = [" - run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'", " - run: git fetch origin chant/lifecycle:chant/lifecycle"];
|
|
241
|
+
const block = (lines: string[]): string[] => [" - run: |", ...lines.map((l) => ` ${l}`)];
|
|
242
|
+
const lines = [
|
|
243
|
+
"name: chant release",
|
|
244
|
+
"on:",
|
|
245
|
+
" workflow_dispatch:",
|
|
246
|
+
" inputs:",
|
|
247
|
+
" label:",
|
|
248
|
+
" description: The release's label, such as v1.4.0",
|
|
249
|
+
" required: true",
|
|
250
|
+
" type: string",
|
|
251
|
+
"permissions:",
|
|
252
|
+
" contents: write",
|
|
253
|
+
" id-token: write",
|
|
254
|
+
"concurrency:",
|
|
255
|
+
" group: chant-release",
|
|
256
|
+
" cancel-in-progress: false",
|
|
257
|
+
"env:",
|
|
258
|
+
" CHANT_RELEASE_LABEL: ${{ inputs.label }}",
|
|
259
|
+
"jobs:",
|
|
260
|
+
" gate:",
|
|
261
|
+
" runs-on: ubuntu-latest",
|
|
262
|
+
...defaults,
|
|
263
|
+
" outputs:",
|
|
264
|
+
" commit: ${{ steps.green.outputs.commit }}",
|
|
265
|
+
" steps:",
|
|
266
|
+
...githubSetup(),
|
|
267
|
+
` - run: ${o.install}`,
|
|
268
|
+
fetches[0]!,
|
|
269
|
+
" - id: green",
|
|
270
|
+
" run: |",
|
|
271
|
+
...[...gateScript(o, "$GITHUB_SHA"), 'echo "commit=$commit" >> "$GITHUB_OUTPUT"'].map((l) => ` ${l}`),
|
|
272
|
+
" cut:",
|
|
273
|
+
" needs: gate",
|
|
274
|
+
" runs-on: ubuntu-latest",
|
|
275
|
+
...defaults,
|
|
276
|
+
" env:",
|
|
277
|
+
` CHANT_RELEASE_COMMIT: ${commit}`,
|
|
278
|
+
" steps:",
|
|
279
|
+
...githubSetup(commit),
|
|
280
|
+
` - run: ${o.install}`,
|
|
281
|
+
...fetches,
|
|
282
|
+
...block(cutScript(o, '"$RUNNER_TEMP/chant-cut.json"')),
|
|
283
|
+
" publish:",
|
|
284
|
+
" needs: [gate, cut]",
|
|
285
|
+
" runs-on: ubuntu-latest",
|
|
286
|
+
...defaults,
|
|
287
|
+
" steps:",
|
|
288
|
+
...githubSetup(commit),
|
|
289
|
+
` - run: ${o.install}`,
|
|
290
|
+
...fetches,
|
|
291
|
+
...(o.images ? [` - run: ${o.chant} release images "$CHANT_RELEASE_LABEL" -o ${RELEASE_DIGESTS_FILE}`, ` - run: echo "CHANT_RELEASE_DIGESTS=$PWD/${RELEASE_DIGESTS_FILE}" >> "$GITHUB_ENV"`] : []),
|
|
292
|
+
...(o.build ? [` - run: ${o.build}`] : []),
|
|
293
|
+
...(o.verify ? [` - run: ${o.chant} release verify "$CHANT_RELEASE_LABEL"`] : []),
|
|
294
|
+
` - run: ${o.chant} release publish "$CHANT_RELEASE_LABEL" ${o.flags}`,
|
|
295
|
+
];
|
|
296
|
+
if (o.after.length > 0) {
|
|
297
|
+
lines.push(" after-release:", " needs: [gate, publish]", " runs-on: ubuntu-latest", ...defaults, " steps:", ...githubSetup(commit), ` - run: ${o.install}`, ...o.after.map((l) => ` - run: ${l}`));
|
|
298
|
+
}
|
|
109
299
|
return tagComments(`${lines.join("\n")}\n`);
|
|
110
300
|
}
|
|
111
301
|
|
|
302
|
+
/**
|
|
303
|
+
* GitLab: the release started from "Run pipeline" with `CHANT_RELEASE_LABEL`
|
|
304
|
+
* set (#4656). The jobs follow each other by `needs`, in the file's default
|
|
305
|
+
* stage, so the including `.gitlab-ci.yml` keeps its own `stages`. A job
|
|
306
|
+
* token cannot push, so the cut and publish jobs push with
|
|
307
|
+
* `CHANT_RELEASE_TOKEN`, a project access token with `write_repository`.
|
|
308
|
+
*/
|
|
309
|
+
function renderGitlabDispatch(o: DispatchInput): string {
|
|
310
|
+
const cd = o.root ? [`cd ${o.root}`] : [];
|
|
311
|
+
const fetches = ["git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'", "git fetch origin chant/lifecycle:chant/lifecycle"];
|
|
312
|
+
const auth = [
|
|
313
|
+
`chant_auth="$(printf 'oauth2:%s' "$CHANT_RELEASE_TOKEN" | base64 | tr -d '\\n')"`,
|
|
314
|
+
'export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraheader GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $chant_auth"',
|
|
315
|
+
"unset chant_auth",
|
|
316
|
+
];
|
|
317
|
+
const job = (name: string, needs: string[], script: string[], extra: string[] = []): string[] => [
|
|
318
|
+
`${name}:`,
|
|
319
|
+
" rules:",
|
|
320
|
+
' - if: $CHANT_RELEASE_LABEL && $CI_PIPELINE_SOURCE =~ /^(web|api|trigger)$/',
|
|
321
|
+
" variables:",
|
|
322
|
+
' GIT_DEPTH: "0"',
|
|
323
|
+
...(needs.length > 0 ? [` needs: [${needs.join(", ")}]`] : []),
|
|
324
|
+
...extra,
|
|
325
|
+
" script:",
|
|
326
|
+
...script.map((l) => ` - ${JSON.stringify(l)}`),
|
|
327
|
+
];
|
|
328
|
+
const checkout = ['git checkout --detach "$CHANT_RELEASE_COMMIT"'];
|
|
329
|
+
const lines = [
|
|
330
|
+
...job("chant-release-gate", [], [...cd, o.install, fetches[0]!, ...gateScript(o, "$CI_COMMIT_SHA"), 'echo "CHANT_RELEASE_COMMIT=$commit" > "$CI_PROJECT_DIR/chant-release-gate.env"'], [" artifacts:", " reports:", " dotenv: chant-release-gate.env"]),
|
|
331
|
+
"",
|
|
332
|
+
...job("chant-release-cut", ["chant-release-gate"], [...checkout, ...cd, o.install, ...fetches, ...auth, ...cutScript(o, "/tmp/chant-cut.json")]),
|
|
333
|
+
"",
|
|
334
|
+
...job(
|
|
335
|
+
"chant-release-publish",
|
|
336
|
+
["chant-release-gate", "chant-release-cut"],
|
|
337
|
+
[
|
|
338
|
+
...checkout,
|
|
339
|
+
...cd,
|
|
340
|
+
o.install,
|
|
341
|
+
...fetches,
|
|
342
|
+
...auth,
|
|
343
|
+
...(o.images ? [`${o.chant} release images "$CHANT_RELEASE_LABEL" -o ${RELEASE_DIGESTS_FILE}`, `export CHANT_RELEASE_DIGESTS="$PWD/${RELEASE_DIGESTS_FILE}"`] : []),
|
|
344
|
+
...(o.build ? [o.build] : []),
|
|
345
|
+
...(o.verify ? [`${o.chant} release verify "$CHANT_RELEASE_LABEL"`] : []),
|
|
346
|
+
`${o.chant} release publish "$CHANT_RELEASE_LABEL" ${o.flags}`,
|
|
347
|
+
],
|
|
348
|
+
[" id_tokens:", " SIGSTORE_ID_TOKEN:", " aud: sigstore"],
|
|
349
|
+
),
|
|
350
|
+
];
|
|
351
|
+
if (o.after.length > 0) lines.push("", ...job("chant-release-after", ["chant-release-gate", "chant-release-publish"], [...checkout, ...cd, o.install, ...o.after]));
|
|
352
|
+
return `${lines.join("\n")}\n`;
|
|
353
|
+
}
|
|
354
|
+
|
|
112
355
|
/** The header that marks the file generated, naming the command that regenerates it. */
|
|
113
356
|
export function releaseWorkflowHeader(command: string): string {
|
|
114
357
|
return `# ${GENERATED_MARKER}. Regenerate with: ${command} (in the workspace root)\n`;
|
|
@@ -144,10 +387,23 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
144
387
|
}
|
|
145
388
|
const groups = securityGroupsAt(root);
|
|
146
389
|
const workspaceRoot = relative(repoRoot, root).split(sep).join("/") || ".";
|
|
390
|
+
// #4656: release.workflow, release.images and release.lane in the root's chant.config.ts.
|
|
391
|
+
let release: import("../config").ChantConfig["release"];
|
|
392
|
+
try {
|
|
393
|
+
const { loadChantConfig } = await import("../config");
|
|
394
|
+
release = (await loadChantConfig(root)).config.release;
|
|
395
|
+
} catch (err) {
|
|
396
|
+
console.error(formatError({ message: `chant.config.ts at the workspace root could not be read: ${err instanceof Error ? err.message : String(err)}`, hint: usage }));
|
|
397
|
+
return 1;
|
|
398
|
+
}
|
|
147
399
|
const text = renderReleaseWorkflow({
|
|
148
400
|
forge,
|
|
149
401
|
groups,
|
|
150
402
|
workspaceRoot,
|
|
403
|
+
...(release?.workflow ? { pipeline: release.workflow } : {}),
|
|
404
|
+
// release.images (#4657) is read loosely, so this file renders with a config of either shape.
|
|
405
|
+
...(((release as { images?: unknown[] } | undefined)?.images?.length ?? 0) > 0 ? { images: true } : {}),
|
|
406
|
+
...(release?.lane ? { lane: release.lane } : {}),
|
|
151
407
|
...(args.ciInstall ? { install: args.ciInstall } : {}),
|
|
152
408
|
...(args.buildCommand ? { build: args.buildCommand } : {}),
|
|
153
409
|
...(args.ciChant ? { chant: args.ciChant } : {}),
|
|
@@ -162,7 +418,9 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
162
418
|
writeFileSync(target, releaseWorkflowHeader(parts.map(shellArg).join(" ")) + text);
|
|
163
419
|
const shown = relative(process.cwd(), target).split(sep).join("/") || target;
|
|
164
420
|
const extras = [groups.has("supply-chain") ? "requires OIDC provenance (supply-chain)" : null, groups.has("verified-releases") ? "verifies the release first (verified-releases)" : null].filter(Boolean);
|
|
165
|
-
|
|
421
|
+
const what = release?.workflow?.trigger === "dispatch" ? "cuts and publishes a release started by hand with its label, from a green commit" : "publishes the release a release/** tag names";
|
|
422
|
+
console.log(formatSuccess(`Wrote ${shown}: ${what}${extras.length > 0 ? `, and ${extras.join(" and ")}` : ""}.`));
|
|
166
423
|
if (forge === "gitlab") console.log(`Include it from .gitlab-ci.yml: include: [{ local: ${RELEASE_WORKFLOW_FILES.gitlab} }]`);
|
|
424
|
+
if (forge === "gitlab" && release?.workflow?.trigger === "dispatch") console.log("The cut and publish jobs push with CHANT_RELEASE_TOKEN: a project access token with write_repository, as a masked CI/CD variable.");
|
|
167
425
|
return 0;
|
|
168
426
|
}
|