@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
package/dist/lexicon.js
CHANGED
|
@@ -90,6 +90,34 @@ export function memberGitlabChanges(member, file = member.file) {
|
|
|
90
90
|
export function memberShellDir(member) {
|
|
91
91
|
return /^[A-Za-z0-9._\/-]+$/.test(member.dir) ? member.dir : `'${member.dir.replace(/'/g, `'\\''`)}'`;
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Check a scheduled Op's `artifacts` (#4622) and return them, or `[]` when it
|
|
95
|
+
* has none. Throws naming the Op on an empty or repeated name, an empty
|
|
96
|
+
* `paths`, an absolute path or one that leaves the job's directory, or a
|
|
97
|
+
* retention that is not a positive whole number of days.
|
|
98
|
+
*/
|
|
99
|
+
export function scheduledOpArtifacts(spec) {
|
|
100
|
+
const list = spec.artifacts ?? [];
|
|
101
|
+
const seen = new Set();
|
|
102
|
+
for (const a of list) {
|
|
103
|
+
const where = `Scheduled Op "${spec.name}" artifact "${a.name}"`;
|
|
104
|
+
if (!a.name || !/^[A-Za-z0-9._-]+$/.test(a.name))
|
|
105
|
+
throw new Error(`Scheduled Op "${spec.name}": an artifact's name is letters, digits, ".", "_" and "-", and "${a.name}" is not.`);
|
|
106
|
+
if (seen.has(a.name))
|
|
107
|
+
throw new Error(`Scheduled Op "${spec.name}" names the artifact "${a.name}" twice.`);
|
|
108
|
+
seen.add(a.name);
|
|
109
|
+
if (a.paths.length === 0)
|
|
110
|
+
throw new Error(`${where} lists no paths.`);
|
|
111
|
+
for (const p of a.paths) {
|
|
112
|
+
if (p === "" || p.startsWith("/") || p.split("/").includes(".."))
|
|
113
|
+
throw new Error(`${where}: "${p}" is not a path inside the job's directory.`);
|
|
114
|
+
}
|
|
115
|
+
if (a.retentionDays !== undefined && (!Number.isInteger(a.retentionDays) || a.retentionDays < 1)) {
|
|
116
|
+
throw new Error(`${where}: retentionDays is a whole number of days, 1 or more.`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return list;
|
|
120
|
+
}
|
|
93
121
|
/**
|
|
94
122
|
* Resolve a `ScheduledOpSpec`'s effective trigger, most specific first:
|
|
95
123
|
* `trigger` when given; else the backward-compatible `{ kind: "cron",
|
|
@@ -85,6 +85,10 @@ export interface FakeForgeRelease {
|
|
|
85
85
|
name?: string;
|
|
86
86
|
/** GitHub: the `make_latest` the release was published with. */
|
|
87
87
|
make_latest?: string;
|
|
88
|
+
/** The release's notes: GitHub's and Forgejo's `body`, GitLab's `description` (#4658). */
|
|
89
|
+
body?: string;
|
|
90
|
+
/** Forgejo: published as a prerelease. */
|
|
91
|
+
prerelease?: boolean;
|
|
88
92
|
}
|
|
89
93
|
/** A forge fake answering through `fetch`: GitHub or Forgejo with draft releases, or GitLab with releases, links and a generic package registry. */
|
|
90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MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC1D,kEAAkE;IAClE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC/B;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,CA+E5H"}
|
|
@@ -256,7 +256,7 @@ export function startFakeForge(forge, api, repo, releases = []) {
|
|
|
256
256
|
const b = JSON.parse(text(init.body));
|
|
257
257
|
if (releases.some((x) => x.tag_name === b.tag_name))
|
|
258
258
|
return json(409, { message: "Release already exists" });
|
|
259
|
-
const r = { id: nextId++, tag_name: b.tag_name, draft: false, target: b.ref, assets: (b.assets?.links ?? []).map((l) => ({ name: l.name, digest: null, bytes: packages.get(l.url) ?? "" })) };
|
|
259
|
+
const r = { id: nextId++, tag_name: b.tag_name, draft: false, target: b.ref, assets: (b.assets?.links ?? []).map((l) => ({ name: l.name, digest: null, bytes: packages.get(l.url) ?? "" })), ...(b.description !== undefined ? { body: b.description } : {}) };
|
|
260
260
|
releases.push(r);
|
|
261
261
|
return json(201, view(r));
|
|
262
262
|
}
|
|
@@ -271,7 +271,7 @@ export function startFakeForge(forge, api, repo, releases = []) {
|
|
|
271
271
|
return json(200, releases.map(view));
|
|
272
272
|
if (init.method === "POST" && path === `${root}/releases`) {
|
|
273
273
|
const b = JSON.parse(text(init.body));
|
|
274
|
-
const r = { id: nextId++, tag_name: b.tag_name, draft: b.draft === true, target: b.target_commitish, assets: [], ...(b.name ? { name: b.name } : {}) };
|
|
274
|
+
const r = { id: nextId++, tag_name: b.tag_name, draft: b.draft === true, target: b.target_commitish, assets: [], ...(b.name ? { name: b.name } : {}), ...(b.body !== undefined ? { body: b.body } : {}) };
|
|
275
275
|
releases.push(r);
|
|
276
276
|
return json(201, view(r));
|
|
277
277
|
}
|
|
@@ -295,6 +295,10 @@ export function startFakeForge(forge, api, repo, releases = []) {
|
|
|
295
295
|
if (!r)
|
|
296
296
|
return json(404, { message: "Not Found" });
|
|
297
297
|
const b = JSON.parse(text(init.body));
|
|
298
|
+
if (b.body !== undefined)
|
|
299
|
+
r.body = b.body;
|
|
300
|
+
if (b.prerelease !== undefined)
|
|
301
|
+
r.prerelease = b.prerelease;
|
|
298
302
|
if (b.draft === false && r.draft) {
|
|
299
303
|
if (releases.some((x) => x !== r && !x.draft && x.tag_name === r.tag_name))
|
|
300
304
|
return json(422, { message: "Validation Failed", errors: [{ code: "already_exists", field: "tag_name" }] });
|
|
@@ -80,7 +80,9 @@ export declare function requestGate(input: RequestGateInput): Promise<RequestGat
|
|
|
80
80
|
/**
|
|
81
81
|
* Record that the request applies under `approval`, which spends it. Throws
|
|
82
82
|
* unless the line was pushed, so two jobs never act on one approval; the
|
|
83
|
-
* caller acts only after this returns.
|
|
83
|
+
* caller acts only after this returns. With no remote for `chant/lifecycle`
|
|
84
|
+
* the local branch is the whole ledger, so the line written to it spends the
|
|
85
|
+
* approval (#4720); a push that failed or that another writer beat still throws.
|
|
84
86
|
*/
|
|
85
87
|
export declare function spendGatedRequest(input: {
|
|
86
88
|
op: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gated-request.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gated-request.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAmD,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAmD,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAwD,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7J,OAAO,EAAkB,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAA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7 @@ import { readGateLedger } from "./gate-ledger.js";
|
|
|
31
31
|
import { pushLifecycleReport, readBlobBySha, readBlobFromPath, readPathSha, RefCASConflictError, requireLifecycleLedger, writeBlobToPath } from "./git.js";
|
|
32
32
|
import { samePlanDigest } from "./plan-digest.js";
|
|
33
33
|
import { gatedRequestAttachmentPath, gatedRequestDigest } from "./gated-request-digest.js";
|
|
34
|
+
import { isLifecycleLocalNote } from "./local-note.js";
|
|
34
35
|
export { gatedRequestAttachmentPath, gatedRequestDigest, gatedRequestOf } from "./gated-request-digest.js";
|
|
35
36
|
/** The first chant with this module (#4551). */
|
|
36
37
|
export { GATED_REQUEST_FLOOR } from "./gate-ledger.js";
|
|
@@ -140,7 +141,9 @@ export async function requestGate(input) {
|
|
|
140
141
|
/**
|
|
141
142
|
* Record that the request applies under `approval`, which spends it. Throws
|
|
142
143
|
* unless the line was pushed, so two jobs never act on one approval; the
|
|
143
|
-
* caller acts only after this returns.
|
|
144
|
+
* caller acts only after this returns. With no remote for `chant/lifecycle`
|
|
145
|
+
* the local branch is the whole ledger, so the line written to it spends the
|
|
146
|
+
* approval (#4720); a push that failed or that another writer beat still throws.
|
|
144
147
|
*/
|
|
145
148
|
export async function spendGatedRequest(input) {
|
|
146
149
|
const record = {
|
|
@@ -156,7 +159,7 @@ export async function spendGatedRequest(input) {
|
|
|
156
159
|
...(input.commit ? { commit: input.commit } : {}),
|
|
157
160
|
};
|
|
158
161
|
const pushed = await appendAppliedLine(input.op, record, `Applied under ${input.gate}`, input.cwd ? { cwd: input.cwd } : undefined);
|
|
159
|
-
if (!pushed.pushed)
|
|
162
|
+
if (!pushed.pushed && !isLifecycleLocalNote(pushed.pushWarning))
|
|
160
163
|
throw new Error(`the approval of ${input.gate} was recorded as spent and not pushed (${pushed.pushWarning ?? "no remote"}), so nothing may apply under it`);
|
|
161
164
|
return record;
|
|
162
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../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AAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGlE;AA0DD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,cAAc,CAMvE"}
|
package/dist/lifecycle/git.js
CHANGED
|
@@ -200,6 +200,11 @@ export async function writeLedgerFiles(files, commitMessage, opts) {
|
|
|
200
200
|
if ((await getStateBranchTip(cwd)) === null) {
|
|
201
201
|
await requireLifecycleLedger({ ...(cwd ? { cwd } : {}) });
|
|
202
202
|
}
|
|
203
|
+
// #4637: start from the remote's records this checkout already fetched. A
|
|
204
|
+
// caller that read a tip (`expectTip`) keeps it, and a run that records
|
|
205
|
+
// nothing leaves the branch alone.
|
|
206
|
+
if (opts?.expectTip === undefined && !ledgerRecordingOff())
|
|
207
|
+
await catchUpLifecycle(cwd);
|
|
203
208
|
// 2-5. Read the trees, build the commit, and CAS-update the branch ref —
|
|
204
209
|
// retried on a conflict (#1959 finding 1). Before that retry existed a
|
|
205
210
|
// conflict from step 5's `updateRefCAS` simply threw, breaking every caller
|
|
@@ -621,6 +626,45 @@ export async function getRemoteLifecycleBranchSha(remote, opts) {
|
|
|
621
626
|
return null;
|
|
622
627
|
return result.stdout.trim() || null;
|
|
623
628
|
}
|
|
629
|
+
/** Whether `ancestor` is in `descendant`'s history. */
|
|
630
|
+
async function isAncestor(ancestor, descendant, cwd) {
|
|
631
|
+
const rt = getRuntime();
|
|
632
|
+
return (await rt.spawn(["git", "merge-base", "--is-ancestor", ancestor, descendant], { cwd, env: C_LOCALE_ENV })).exitCode === 0;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Fast-forward the local `chant/lifecycle` to the ledger remote's tip this
|
|
636
|
+
* checkout has already fetched, when it is behind it (#4637). A plain
|
|
637
|
+
* `git fetch` in a full clone moves `refs/remotes/<remote>/chant/lifecycle`
|
|
638
|
+
* and leaves the branch, so a write built on the branch would sit beside the
|
|
639
|
+
* records made elsewhere instead of after them. Nothing is fetched here, and a
|
|
640
|
+
* branch with commits the remote lacks is left for the push to replay. The
|
|
641
|
+
* move is a compare-and-swap, so a writer that moved the branch meanwhile is
|
|
642
|
+
* never undone, and a checked-out `chant/lifecycle` is left alone.
|
|
643
|
+
*/
|
|
644
|
+
async function catchUpLifecycle(cwd) {
|
|
645
|
+
const rt = getRuntime();
|
|
646
|
+
const found = await ledgerRemote(cwd);
|
|
647
|
+
if (found === null || "failed" in found)
|
|
648
|
+
return;
|
|
649
|
+
const fetched = await getRemoteLifecycleBranchSha(found.remote, { cwd });
|
|
650
|
+
if (!fetched)
|
|
651
|
+
return;
|
|
652
|
+
const local = await getStateBranchTip(cwd);
|
|
653
|
+
if (!local || local === fetched)
|
|
654
|
+
return;
|
|
655
|
+
if (!(await isAncestor(local, fetched, cwd)))
|
|
656
|
+
return;
|
|
657
|
+
const head = await rt.spawn(["git", "symbolic-ref", "-q", "HEAD"], { cwd, env: C_LOCALE_ENV });
|
|
658
|
+
if (head.exitCode === 0 && head.stdout.trim() === `refs/heads/${STATE_BRANCH}`)
|
|
659
|
+
return;
|
|
660
|
+
try {
|
|
661
|
+
await updateRefCAS(`refs/heads/${STATE_BRANCH}`, fetched, local, { cwd });
|
|
662
|
+
}
|
|
663
|
+
catch (err) {
|
|
664
|
+
if (!(err instanceof RefCASConflictError))
|
|
665
|
+
throw err;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
624
668
|
/**
|
|
625
669
|
* Point `refs/remotes/<remote>/chant/lifecycle` at `sha`, the remote tip this
|
|
626
670
|
* checkout has just seen (#3391).
|
|
@@ -664,6 +708,19 @@ export async function pushLifecycleStatus(opts) {
|
|
|
664
708
|
const expected = await getRemoteLifecycleBranchSha(remote, opts);
|
|
665
709
|
const lease = `refs/heads/${STATE_BRANCH}:${expected ?? ""}`;
|
|
666
710
|
const tip = await getStateBranchTip(cwd);
|
|
711
|
+
// #4637: the lease only says the remote still holds `expected`. A plain
|
|
712
|
+
// `git fetch` moves that ref without moving the local branch, so a branch
|
|
713
|
+
// that does not contain it would pass the lease and push over every record
|
|
714
|
+
// made since (an approval from another clone). Refused as stale, so a
|
|
715
|
+
// rebasing caller replays its commits onto the remote's tip.
|
|
716
|
+
if (expected && tip && expected !== tip && !(await isAncestor(expected, tip, cwd))) {
|
|
717
|
+
return {
|
|
718
|
+
status: "stale",
|
|
719
|
+
remote,
|
|
720
|
+
expected,
|
|
721
|
+
stderr: `this checkout's ${STATE_BRANCH} does not contain ${expected.slice(0, 12)}, the tip it last fetched from "${remote}"; pushing it would drop the records made since`,
|
|
722
|
+
};
|
|
723
|
+
}
|
|
667
724
|
const pushResult = await rt.spawn(["git", "push", `--force-with-lease=${lease}`, remote, `${STATE_BRANCH}:${STATE_BRANCH}`], { cwd, env: C_LOCALE_ENV });
|
|
668
725
|
if (pushResult.exitCode !== 0) {
|
|
669
726
|
const stderr = (pushResult.stderr ?? "").trim();
|
|
@@ -38,6 +38,7 @@ export declare const NpmPublishSchema: z.ZodObject<{
|
|
|
38
38
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
39
39
|
stage: z.ZodOptional<z.ZodBoolean>;
|
|
40
40
|
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
41
|
+
pins: z.ZodOptional<z.ZodString>;
|
|
41
42
|
registryWait: z.ZodOptional<z.ZodNumber>;
|
|
42
43
|
}, z.core.$strict>;
|
|
43
44
|
/** An OCI registry such as GHCR or Docker Hub: the image is pushed by digest, then tagged. */
|
|
@@ -61,6 +62,13 @@ export declare const ForgePublishSchema: z.ZodObject<{
|
|
|
61
62
|
repo: z.ZodString;
|
|
62
63
|
api: z.ZodOptional<z.ZodString>;
|
|
63
64
|
assets: z.ZodArray<z.ZodString>;
|
|
65
|
+
notes: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
file: z.ZodString;
|
|
67
|
+
heading: z.ZodString;
|
|
68
|
+
linkBase: z.ZodOptional<z.ZodString>;
|
|
69
|
+
before: z.ZodOptional<z.ZodString>;
|
|
70
|
+
after: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>>;
|
|
64
72
|
tag: z.ZodOptional<z.ZodString>;
|
|
65
73
|
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
66
74
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -135,6 +143,7 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
135
143
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
136
144
|
stage: z.ZodOptional<z.ZodBoolean>;
|
|
137
145
|
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
146
|
+
pins: z.ZodOptional<z.ZodString>;
|
|
138
147
|
registryWait: z.ZodOptional<z.ZodNumber>;
|
|
139
148
|
}, z.core.$strict>, z.ZodObject<{
|
|
140
149
|
type: z.ZodLiteral<"oci">;
|
|
@@ -154,6 +163,13 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
154
163
|
repo: z.ZodString;
|
|
155
164
|
api: z.ZodOptional<z.ZodString>;
|
|
156
165
|
assets: z.ZodArray<z.ZodString>;
|
|
166
|
+
notes: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
file: z.ZodString;
|
|
168
|
+
heading: z.ZodString;
|
|
169
|
+
linkBase: z.ZodOptional<z.ZodString>;
|
|
170
|
+
before: z.ZodOptional<z.ZodString>;
|
|
171
|
+
after: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strict>>;
|
|
157
173
|
tag: z.ZodOptional<z.ZodString>;
|
|
158
174
|
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
159
175
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-declaration.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"publish-declaration.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;kBA6ClB,CAAC;AAEZ,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB;;;;;;;;kBAgBlB,CAAC;AAEZ,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;kBAgD6G,CAAC;AAE7I;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;kBA0BvB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;kBA4B1B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;kBA4B3B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAqK,CAAC;AAE3M,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACrF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -65,6 +65,14 @@ export const NpmPublishSchema = z
|
|
|
65
65
|
* registry accepts a publish before it serves it. Unset, the wait ends
|
|
66
66
|
* only when every version is served or the registry fails (#4271).
|
|
67
67
|
*/
|
|
68
|
+
/**
|
|
69
|
+
* A file in the package, from its root, holding the image digests it pins
|
|
70
|
+
* (#4657), such as `dist/image-digests.json`. Every `sha256:` digest in it
|
|
71
|
+
* must be an image the release records, or the plan and `chant release
|
|
72
|
+
* verify` refuse the package. A package without the file is not checked,
|
|
73
|
+
* and a target none of whose packages has it is refused.
|
|
74
|
+
*/
|
|
75
|
+
pins: z.string().min(1).optional(),
|
|
68
76
|
registryWait: z.number().int().min(0).optional(),
|
|
69
77
|
})
|
|
70
78
|
.strict();
|
|
@@ -95,8 +103,31 @@ export const ForgePublishSchema = z
|
|
|
95
103
|
repo: z.string().min(1),
|
|
96
104
|
/** The API root: default `$GITHUB_API_URL` or `https://api.github.com` on GitHub, `$CI_API_V4_URL` or `https://gitlab.com/api/v4` on GitLab, `$GITHUB_API_URL` on Forgejo, which has no default. */
|
|
97
105
|
api: z.string().url().optional(),
|
|
98
|
-
/** Files to attach, relative to the member. */
|
|
99
|
-
assets: z.array(z.string().min(1))
|
|
106
|
+
/** Files to attach, relative to the member. May be empty when `notes` gives the release its body. */
|
|
107
|
+
assets: z.array(z.string().min(1)),
|
|
108
|
+
/**
|
|
109
|
+
* The release's notes (#4658): a section of a file in the member, sent as
|
|
110
|
+
* the release's body on GitHub and Forgejo and its description on GitLab.
|
|
111
|
+
*/
|
|
112
|
+
notes: z
|
|
113
|
+
.object({
|
|
114
|
+
/** The file, relative to the member, such as `CHANGELOG.md` or a docs site's changes page. */
|
|
115
|
+
file: z.string().min(1),
|
|
116
|
+
/**
|
|
117
|
+
* The heading that starts the section, such as `## In {version}` or `## [{version}]`. `{label}`, `{version}`
|
|
118
|
+
* (the label from its first digit) and `{tag}` are filled in. The section runs to the next heading of the same
|
|
119
|
+
* level or higher.
|
|
120
|
+
*/
|
|
121
|
+
heading: z.string().regex(/^#{1,6} \S/, "a markdown heading, such as ## {version}"),
|
|
122
|
+
/** Links that start with `/` are made absolute against this, such as `https://docs.example.com`. */
|
|
123
|
+
linkBase: z.string().url().optional(),
|
|
124
|
+
/** A paragraph before the section, with the same placeholders. */
|
|
125
|
+
before: z.string().min(1).optional(),
|
|
126
|
+
/** A paragraph after the section, with the same placeholders. */
|
|
127
|
+
after: z.string().min(1).optional(),
|
|
128
|
+
})
|
|
129
|
+
.strict()
|
|
130
|
+
.optional(),
|
|
100
131
|
/** The forge release's tag. Default: the tag the cut made, `release/<label>` or `release/<member>/<label>`. */
|
|
101
132
|
tag: z.string().min(1).optional(),
|
|
102
133
|
/** The variable holding the token. Default `GITHUB_TOKEN`, `GITLAB_TOKEN` (then `CI_JOB_TOKEN`), or `FORGEJO_TOKEN`. */
|
|
@@ -111,7 +142,8 @@ export const ForgePublishSchema = z
|
|
|
111
142
|
*/
|
|
112
143
|
latest: z.union([z.boolean(), z.literal("legacy")]).optional(),
|
|
113
144
|
})
|
|
114
|
-
.strict()
|
|
145
|
+
.strict()
|
|
146
|
+
.refine((d) => d.assets.length > 0 || d.notes !== undefined, { message: "a forge release needs assets, notes or both", path: ["assets"] });
|
|
115
147
|
/**
|
|
116
148
|
* A Homebrew formula in a tap repository on GitHub (#4676), rendered from a
|
|
117
149
|
* template in the member with the release's version and each asset's URL and
|
|
@@ -47,6 +47,18 @@ import type { ForgePublishDeclaration } from "./publish-declaration.js";
|
|
|
47
47
|
import { type PublishDeps, type PublishTarget } from "./release-publish.js";
|
|
48
48
|
/** The first chant that reads `latest` on a forge target and sends it as GitHub's `make_latest` (#4676). */
|
|
49
49
|
export declare const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
|
|
50
|
+
/** The first chant whose forge target reads `notes` and may have no assets (#4658). Products feature-detect on it. */
|
|
51
|
+
export declare const PUBLISH_FORGE_NOTES_FLOOR = "0.124.71";
|
|
52
|
+
/**
|
|
53
|
+
* The section of `page` that starts at the heading `heading` names (#4658),
|
|
54
|
+
* up to the next heading of the same level or higher, trimmed. A heading
|
|
55
|
+
* matches when it is the pattern, or the pattern and then whitespace, so
|
|
56
|
+
* `## [1.2.3] - 2026-11-07` matches `## [1.2.3]`, and neither `## 1.2.30`
|
|
57
|
+
* nor `## 1.2.3-rc.1` matches `## 1.2.3`. Links that start with `/` are
|
|
58
|
+
* made absolute against `linkBase`. Throws when there is no such heading or
|
|
59
|
+
* the section is empty.
|
|
60
|
+
*/
|
|
61
|
+
export declare function releaseNotesSection(page: string, heading: string, linkBase?: string): string;
|
|
50
62
|
/** The variables a forge's token is read from, in order. */
|
|
51
63
|
export declare function forgeTokenEnv(decl: Pick<ForgePublishDeclaration, "forge" | "tokenEnv">): string[];
|
|
52
64
|
/** The API root a forge is reached at. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-forge.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;
|
|
1
|
+
{"version":3,"file":"publish-forge.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAQH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAA2C,KAAK,WAAW,EAAuC,KAAK,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAE1K,4GAA4G;AAC5G,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,sHAAsH;AACtH,eAAO,MAAM,yBAAyB,aAAe,CAAC;AAOtD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CA2B5F;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG,MAAM,EAAE,CAKjG;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,CAGpH;AA8ID,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,WAAW,GAAG,aAAa,CAqJ3F"}
|
|
@@ -46,11 +46,61 @@
|
|
|
46
46
|
import { readFileSync } from "node:fs";
|
|
47
47
|
import { basename } from "node:path";
|
|
48
48
|
import { memberSbom, releaseProvenance } from "./publish-attachments.js";
|
|
49
|
+
import { releaseVersion } from "./publish-homebrew.js";
|
|
50
|
+
import { NEXT_RELEASE } from "../release-floors.js";
|
|
49
51
|
import { readCredential } from "./publish-credentials.js";
|
|
50
52
|
import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
|
|
51
53
|
import { PublishTargetError } from "./release-publish.js";
|
|
52
54
|
/** The first chant that reads `latest` on a forge target and sends it as GitHub's `make_latest` (#4676). */
|
|
53
55
|
export const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
|
|
56
|
+
/** The first chant whose forge target reads `notes` and may have no assets (#4658). Products feature-detect on it. */
|
|
57
|
+
export const PUBLISH_FORGE_NOTES_FLOOR = NEXT_RELEASE;
|
|
58
|
+
/** `text` with `{label}`, `{version}` and `{tag}` filled in. */
|
|
59
|
+
function fillNotesText(text, values) {
|
|
60
|
+
return text.replaceAll("{label}", values.label).replaceAll("{version}", values.version).replaceAll("{tag}", values.tag);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The section of `page` that starts at the heading `heading` names (#4658),
|
|
64
|
+
* up to the next heading of the same level or higher, trimmed. A heading
|
|
65
|
+
* matches when it is the pattern, or the pattern and then whitespace, so
|
|
66
|
+
* `## [1.2.3] - 2026-11-07` matches `## [1.2.3]`, and neither `## 1.2.30`
|
|
67
|
+
* nor `## 1.2.3-rc.1` matches `## 1.2.3`. Links that start with `/` are
|
|
68
|
+
* made absolute against `linkBase`. Throws when there is no such heading or
|
|
69
|
+
* the section is empty.
|
|
70
|
+
*/
|
|
71
|
+
export function releaseNotesSection(page, heading, linkBase) {
|
|
72
|
+
const level = /^(#+)/.exec(heading)[1].length;
|
|
73
|
+
const lines = page.split("\n");
|
|
74
|
+
const matches = (l) => {
|
|
75
|
+
const t = l.trimEnd();
|
|
76
|
+
return t === heading || (t.startsWith(heading) && /^\s/.test(t.slice(heading.length)));
|
|
77
|
+
};
|
|
78
|
+
const start = lines.findIndex(matches);
|
|
79
|
+
if (start < 0)
|
|
80
|
+
throw new Error(`it has no heading "${heading}"`);
|
|
81
|
+
// A `#` line inside a fenced code block is code, not a heading.
|
|
82
|
+
let end = lines.length;
|
|
83
|
+
let fence = null;
|
|
84
|
+
for (let i = start + 1; i < lines.length; i++) {
|
|
85
|
+
const f = /^\s*(```|~~~)/.exec(lines[i]);
|
|
86
|
+
if (f)
|
|
87
|
+
fence = fence === null ? f[1] : fence === f[1] ? null : fence;
|
|
88
|
+
if (fence !== null || f)
|
|
89
|
+
continue;
|
|
90
|
+
const m = /^(#{1,6}) /.exec(lines[i]);
|
|
91
|
+
if (m && m[1].length <= level) {
|
|
92
|
+
end = i;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const body = lines.slice(start + 1, end).join("\n").trim();
|
|
97
|
+
if (!body)
|
|
98
|
+
throw new Error(`its "${heading}" section is empty`);
|
|
99
|
+
if (!linkBase)
|
|
100
|
+
return body;
|
|
101
|
+
const base = linkBase.replace(/\/+$/, "");
|
|
102
|
+
return body.replace(/\]\((\/(?!\/)[^)\s]*)/g, (_, path) => `](${base}${path}`);
|
|
103
|
+
}
|
|
54
104
|
/** The variables a forge's token is read from, in order. */
|
|
55
105
|
export function forgeTokenEnv(decl) {
|
|
56
106
|
if (decl.tokenEnv)
|
|
@@ -125,7 +175,7 @@ class ForgeClient {
|
|
|
125
175
|
return this.toRelease(found.json, tag);
|
|
126
176
|
}
|
|
127
177
|
/** GitHub and Forgejo: the draft release for `tag`, made at `commit` when there is none. */
|
|
128
|
-
async draft(tag, commit, name) {
|
|
178
|
+
async draft(tag, commit, name, body) {
|
|
129
179
|
const list = await this.call("GET", `${this.repoPath}/releases?per_page=100`);
|
|
130
180
|
if (list.status !== 200)
|
|
131
181
|
this.fail("listing releases", list.status, list.text);
|
|
@@ -136,22 +186,31 @@ class ForgeClient {
|
|
|
136
186
|
return this.toRelease(mine, tag);
|
|
137
187
|
}
|
|
138
188
|
this.ctx.log(`creating a draft ${this.decl.forge} release for ${tag} at ${commit.slice(0, 12)}`);
|
|
139
|
-
const create = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, target_commitish: commit, name, draft: true }));
|
|
189
|
+
const create = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, target_commitish: commit, name, draft: true, ...(body !== undefined ? { body } : {}) }));
|
|
140
190
|
if (create.status !== 201 || !create.json)
|
|
141
191
|
this.fail(`creating a draft release ${tag}`, create.status, create.text);
|
|
142
192
|
return this.toRelease(create.json, tag);
|
|
143
193
|
}
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
194
|
+
/**
|
|
195
|
+
* GitHub and Forgejo: publish the draft `id` with its notes. GitHub gets
|
|
196
|
+
* `make_latest`: the declared `latest`, else `false` for a release cut to a
|
|
197
|
+
* channel and `true` for any other (#4658). Forgejo has no such setting and
|
|
198
|
+
* takes the newest release that is not a prerelease, so a channel's release
|
|
199
|
+
* is marked a prerelease there.
|
|
200
|
+
*/
|
|
201
|
+
async publishDraft(id, tag, o) {
|
|
202
|
+
const body = { draft: false, ...(o.notes !== undefined ? { body: o.notes } : {}) };
|
|
203
|
+
if (this.decl.forge === "github")
|
|
204
|
+
body.make_latest = String(this.decl.latest ?? !o.channel);
|
|
205
|
+
else if (o.channel)
|
|
206
|
+
body.prerelease = true;
|
|
148
207
|
const res = await this.call("PATCH", `${this.repoPath}/releases/${id}`, JSON.stringify(body));
|
|
149
208
|
if (res.status !== 200)
|
|
150
209
|
this.fail(`publishing the draft release ${tag}`, res.status, res.text);
|
|
151
210
|
}
|
|
152
211
|
/** GitLab: create the release for `tag` at `commit` with a link to each asset. */
|
|
153
|
-
async createWithLinks(tag, commit, name, links) {
|
|
154
|
-
const res = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, ref: commit, name, assets: { links: links.map((l) => ({ ...l, link_type: "package" })) } }));
|
|
212
|
+
async createWithLinks(tag, commit, name, links, notes) {
|
|
213
|
+
const res = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, ref: commit, name, ...(notes !== undefined ? { description: notes } : {}), assets: { links: links.map((l) => ({ ...l, link_type: "package" })) } }));
|
|
155
214
|
if (res.status !== 201)
|
|
156
215
|
this.fail(`creating release ${tag}`, res.status, res.text);
|
|
157
216
|
}
|
|
@@ -210,9 +269,11 @@ export function forgeTarget(decl, deps) {
|
|
|
210
269
|
checkReleaseDigest(ctx.release, "asset", ctx.cwd, p, [digest]);
|
|
211
270
|
return { path: p, name: basename(p), bytes, digest };
|
|
212
271
|
});
|
|
213
|
-
// #4049: the SBOM and the provenance statement over the assets go on the release with them.
|
|
272
|
+
// #4049: the SBOM and the provenance statement over the assets go on the release with them. A release of notes alone has no asset to state.
|
|
214
273
|
const sbom = memberSbom(ctx, decl.sbom, `${decl.repo}@${tag}`, `the ${decl.forge} target`);
|
|
215
|
-
const provenance =
|
|
274
|
+
const provenance = assets.length > 0
|
|
275
|
+
? releaseProvenance(ctx, assets.map((a) => ({ name: a.name, digest: a.digest })))
|
|
276
|
+
: null;
|
|
216
277
|
for (const a of [sbom, provenance])
|
|
217
278
|
if (a)
|
|
218
279
|
assets.push({ path: a.name, name: a.name, bytes: a.bytes, digest: a.digest, attachment: a.kind });
|
|
@@ -222,7 +283,25 @@ export function forgeTarget(decl, deps) {
|
|
|
222
283
|
throw new PublishTargetError("publish-forge-asset-name-taken", `two assets are named ${a.name}, and a release holds one asset per name`);
|
|
223
284
|
names.add(a.name);
|
|
224
285
|
}
|
|
225
|
-
return { tag, api, token, assets };
|
|
286
|
+
return { tag, api, token, assets, notes: releaseNotes(ctx, tag) };
|
|
287
|
+
};
|
|
288
|
+
// #4658: the notes are read when the target is planned, so a missing or empty section refuses before any target publishes.
|
|
289
|
+
const releaseNotes = (ctx, tag) => {
|
|
290
|
+
const n = decl.notes;
|
|
291
|
+
if (!n)
|
|
292
|
+
return undefined;
|
|
293
|
+
const label = ctx.label ?? tag;
|
|
294
|
+
const values = { label, version: releaseVersion(ctx.label) ?? label, tag };
|
|
295
|
+
const heading = fillNotesText(n.heading, values);
|
|
296
|
+
let section;
|
|
297
|
+
try {
|
|
298
|
+
section = releaseNotesSection(readFileSync(memberFile(ctx.cwd, n.file), "utf8"), heading, n.linkBase);
|
|
299
|
+
}
|
|
300
|
+
catch (err) {
|
|
301
|
+
const why = err.code === "ENOENT" ? "it does not exist" : err.message;
|
|
302
|
+
throw new PublishTargetError("publish-forge-notes-missing", `the ${decl.forge} release's notes come from ${n.file}, and ${why}`, `Write the "${heading}" section in ${n.file}, or change notes.heading.`);
|
|
303
|
+
}
|
|
304
|
+
return [...(n.before ? [fillNotesText(n.before, values), ""] : []), section, ...(n.after ? ["", fillNotesText(n.after, values)] : [])].join("\n") + "\n";
|
|
226
305
|
};
|
|
227
306
|
const att = (a) => (a.attachment ? { attachment: a.attachment } : {});
|
|
228
307
|
const where = (tag, name) => `${decl.forge} ${decl.repo} release ${tag}, asset ${name}`;
|
|
@@ -234,11 +313,14 @@ export function forgeTarget(decl, deps) {
|
|
|
234
313
|
credentialEnv: tokenNames,
|
|
235
314
|
key: publishTargetKey(decl),
|
|
236
315
|
async plan(ctx) {
|
|
237
|
-
const { tag, assets } = setup(ctx);
|
|
238
|
-
return
|
|
316
|
+
const { tag, assets, notes } = setup(ctx);
|
|
317
|
+
return [
|
|
318
|
+
...assets.map((a) => ({ name: a.path, destination: where(tag, a.name), digest: a.digest, ...att(a) })),
|
|
319
|
+
...(notes !== undefined ? [{ name: decl.notes.file, destination: `${decl.forge} ${decl.repo} release ${tag}, notes`, notes }] : []),
|
|
320
|
+
];
|
|
239
321
|
},
|
|
240
322
|
async stage(ctx) {
|
|
241
|
-
const { tag, api, token, assets } = setup(ctx);
|
|
323
|
+
const { tag, api, token, assets, notes } = setup(ctx);
|
|
242
324
|
ctx.log(`using the token from ${token.from}`);
|
|
243
325
|
const client = new ForgeClient(decl, api, token, fetchImpl, ctx);
|
|
244
326
|
const done = (items, state) => ({ target: this.name, destination: this.destination, items, state });
|
|
@@ -268,7 +350,7 @@ export function forgeTarget(decl, deps) {
|
|
|
268
350
|
}
|
|
269
351
|
return done(items, {});
|
|
270
352
|
}
|
|
271
|
-
const rel = await client.draft(tag, ctx.release.commit, ctx.label ?? tag);
|
|
353
|
+
const rel = await client.draft(tag, ctx.release.commit, ctx.label ?? tag, notes);
|
|
272
354
|
const items = [];
|
|
273
355
|
for (const a of assets) {
|
|
274
356
|
if (rel.assets.has(a.name)) {
|
|
@@ -285,21 +367,23 @@ export function forgeTarget(decl, deps) {
|
|
|
285
367
|
return done(items, { releaseId: rel.id });
|
|
286
368
|
},
|
|
287
369
|
async reveal(ctx, staged) {
|
|
288
|
-
const { tag, api, token } = setup(ctx);
|
|
370
|
+
const { tag, api, token, notes } = setup(ctx);
|
|
289
371
|
const client = new ForgeClient(decl, api, token, fetchImpl, ctx);
|
|
290
372
|
const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}), ...(i.attachment ? { attachment: i.attachment } : {}) }));
|
|
291
373
|
if (staged.state.published === "true")
|
|
292
374
|
return { target: this.name, destination: this.destination, items: items.map((i) => ({ ...i, present: true })) };
|
|
293
375
|
if (decl.forge === "gitlab") {
|
|
294
376
|
ctx.log(`creating the gitlab release ${tag} at ${ctx.release.commit.slice(0, 12)} with ${items.length} asset link(s)`);
|
|
295
|
-
await client.createWithLinks(tag, ctx.release.commit, ctx.label ?? tag, items.map((i) => ({ name: basename(i.name), url: i.destination })));
|
|
377
|
+
await client.createWithLinks(tag, ctx.release.commit, ctx.label ?? tag, items.map((i) => ({ name: basename(i.name), url: i.destination })), notes);
|
|
296
378
|
}
|
|
297
379
|
else {
|
|
298
380
|
const id = staged.state.releaseId;
|
|
299
381
|
if (!id)
|
|
300
382
|
throw new PublishTargetError("publish-forge-failed", `the staged ${decl.forge} release for ${tag} has no draft id to publish`);
|
|
301
|
-
|
|
302
|
-
|
|
383
|
+
const channel = ctx.tag !== null;
|
|
384
|
+
const latest = decl.forge === "github" ? ` with make_latest ${String(decl.latest ?? !channel)}` : channel ? " as a prerelease, since it was cut to a channel" : "";
|
|
385
|
+
ctx.log(`publishing the draft ${decl.forge} release ${tag}${notes !== undefined ? " with its notes" : ""}${latest}`);
|
|
386
|
+
await client.publishDraft(id, tag, { ...(notes !== undefined ? { notes } : {}), channel });
|
|
303
387
|
}
|
|
304
388
|
return { target: this.name, destination: this.destination, items };
|
|
305
389
|
},
|