@catladder/cli 0.0.0-next-89bce6d0 → 0.0.0-next-ddc387fe
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/apps/cli/src/release/changesetsReleaseJob.js +4 -0
- package/dist/apps/cli/src/release/changesetsReleaseJob.js.map +1 -1
- package/dist/apps/cli/src/release/githubQueuedRelease.js +22 -3
- package/dist/apps/cli/src/release/githubQueuedRelease.js.map +1 -1
- package/dist/apps/cli/src/release/stepSummary.d.ts +6 -0
- package/dist/apps/cli/src/release/stepSummary.js +32 -0
- package/dist/apps/cli/src/release/stepSummary.js.map +1 -0
- package/dist/bundles/catci/index.js +3 -3
- package/dist/bundles/catenv/index.js +216 -109
- package/dist/bundles/cli/index.js +216 -109
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +8 -1
- package/dist/bundles/skills/catladder-releases/SKILL.md +17 -10
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +93 -72
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/ensureImageJobs.d.ts +12 -0
- package/dist/packages/pipeline/src/backends/github/ensureImageJobs.js +40 -0
- package/dist/packages/pipeline/src/backends/github/ensureImageJobs.js.map +1 -0
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.d.ts +17 -14
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.js +76 -37
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.js.map +1 -1
- package/dist/skills/catladder-pipelines/SKILL.md +8 -1
- package/dist/skills/catladder-releases/SKILL.md +17 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/release/changesetsReleaseJob.ts +6 -0
- package/src/release/githubQueuedRelease.ts +37 -3
- package/src/release/stepSummary.ts +27 -0
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
renderChangelogEntries,
|
|
17
17
|
} from "./changesets";
|
|
18
18
|
import { ensureReleaseHistory, getLastReleaseTag, git } from "./releaseGit";
|
|
19
|
+
import { appendStepSummary } from "./stepSummary";
|
|
19
20
|
|
|
20
21
|
const CHANGESET_DIR = ".changeset";
|
|
21
22
|
const CHANGELOG_FILE = "CHANGELOG.md";
|
|
@@ -149,6 +150,10 @@ export const changesetsReleaseJob = async () => {
|
|
|
149
150
|
console.log(
|
|
150
151
|
"to release anyway (patch bump), run the force release job instead",
|
|
151
152
|
);
|
|
153
|
+
appendStepSummary(
|
|
154
|
+
`ℹ️ **Nothing released** — no pending changesets in \`${CHANGESET_DIR}/\`. ` +
|
|
155
|
+
"Merge a changeset and release again, or force the release for a patch bump.",
|
|
156
|
+
);
|
|
152
157
|
return;
|
|
153
158
|
}
|
|
154
159
|
const changesets = forcedEmpty ? [FORCED_RELEASE_CHANGESET] : pending;
|
|
@@ -194,6 +199,7 @@ export const changesetsReleaseJob = async () => {
|
|
|
194
199
|
await git("tag", tag);
|
|
195
200
|
await pushCommitAndTag(tag);
|
|
196
201
|
console.log(`released ${tag}`);
|
|
202
|
+
appendStepSummary(`🚀 **Released ${tag}**\n\n${entries}`);
|
|
197
203
|
|
|
198
204
|
if (process.env.GITHUB_ACTIONS === "true") {
|
|
199
205
|
await dispatchTaggedReleaseWorkflow(tag);
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { appendFileSync } from "fs";
|
|
21
21
|
import { git } from "./releaseGit";
|
|
22
|
+
import { appendStepSummary, workflowLink } from "./stepSummary";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* the generated main-branch workflow whose runs gate a queued release.
|
|
@@ -27,6 +28,13 @@ import { git } from "./releaseGit";
|
|
|
27
28
|
*/
|
|
28
29
|
const GITHUB_MAIN_WORKFLOW = "catladder-main.yml";
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* the workflow that picks up a queued release, for summary links. Keep
|
|
33
|
+
* in sync with the release-on-green file name in
|
|
34
|
+
* pipeline/src/backends/github/GithubBackend.ts.
|
|
35
|
+
*/
|
|
36
|
+
const GITHUB_ON_GREEN_WORKFLOW = "catladder-release-on-green.yml";
|
|
37
|
+
|
|
30
38
|
/**
|
|
31
39
|
* where a queued release is recorded: a ref outside refs/heads and
|
|
32
40
|
* refs/tags, pointing at the commit the release was queued for.
|
|
@@ -109,28 +117,43 @@ export const githubQueueCheckJob = async () => {
|
|
|
109
117
|
const run = await getMainWorkflowRun(sha);
|
|
110
118
|
if (!run) {
|
|
111
119
|
console.log(`no main workflow run found for ${sha} — releasing right away`);
|
|
120
|
+
appendStepSummary(
|
|
121
|
+
`ℹ️ No main workflow run found for \`${sha}\` — releasing right away.`,
|
|
122
|
+
);
|
|
112
123
|
setStepOutput("queued", "false");
|
|
113
124
|
return;
|
|
114
125
|
}
|
|
115
126
|
if (run.status === "completed") {
|
|
116
127
|
if (run.conclusion === "success") {
|
|
117
128
|
console.log(`main workflow for ${sha} succeeded — releasing right away`);
|
|
129
|
+
appendStepSummary(
|
|
130
|
+
`✅ The main workflow for \`${sha}\` succeeded — releasing right away.`,
|
|
131
|
+
);
|
|
118
132
|
setStepOutput("queued", "false");
|
|
119
133
|
return;
|
|
120
134
|
}
|
|
135
|
+
appendStepSummary(
|
|
136
|
+
`❌ Not releasing: the ${workflowLink(GITHUB_MAIN_WORKFLOW, "main workflow")} run for \`${sha}\` concluded **${run.conclusion}**. ` +
|
|
137
|
+
`Fix the pipeline, or re-run with the force checkbox to release anyway.`,
|
|
138
|
+
);
|
|
121
139
|
fail(
|
|
122
140
|
`the main workflow for ${sha} concluded '${run.conclusion}' — ` +
|
|
123
|
-
`fix the pipeline, or
|
|
141
|
+
`fix the pipeline, or force the release to release anyway`,
|
|
124
142
|
);
|
|
125
143
|
}
|
|
126
144
|
// queued / in_progress / waiting: record the intent and let the
|
|
127
145
|
// release-on-green workflow do the release. Force-push: a re-queue
|
|
128
146
|
// (or a stale marker of an older commit) just moves the marker.
|
|
129
147
|
await git("push", "origin", `+${sha}:${QUEUE_MARKER_REF}`);
|
|
148
|
+
const runState = run.status.replace(/_/g, " ");
|
|
130
149
|
console.log(
|
|
131
|
-
`main workflow for ${sha} is ${
|
|
150
|
+
`main workflow for ${sha} is ${runState} — release queued: ` +
|
|
132
151
|
`the 'release on green' workflow creates the release as soon as the run succeeds`,
|
|
133
152
|
);
|
|
153
|
+
appendStepSummary(
|
|
154
|
+
`⏳ **Release queued** for \`${sha}\` — the ${workflowLink(GITHUB_MAIN_WORKFLOW, "main workflow")} run is still ${runState}. ` +
|
|
155
|
+
`${workflowLink(GITHUB_ON_GREEN_WORKFLOW, "release on green")} creates the release as soon as it succeeds.`,
|
|
156
|
+
);
|
|
134
157
|
setStepOutput("queued", "true");
|
|
135
158
|
};
|
|
136
159
|
|
|
@@ -149,6 +172,7 @@ export const githubQueuedGuardJob = async (
|
|
|
149
172
|
const marker = markerLine.split(/\s+/)[0] ?? "";
|
|
150
173
|
if (!marker) {
|
|
151
174
|
console.log("no release queued — nothing to do");
|
|
175
|
+
appendStepSummary("No release queued — nothing to do.");
|
|
152
176
|
setStepOutput("release", "false");
|
|
153
177
|
return;
|
|
154
178
|
}
|
|
@@ -156,6 +180,9 @@ export const githubQueuedGuardJob = async (
|
|
|
156
180
|
console.log(
|
|
157
181
|
`queued release is for ${marker}, this run is for ${headSha} — leaving the queue untouched`,
|
|
158
182
|
);
|
|
183
|
+
appendStepSummary(
|
|
184
|
+
`Queued release is for \`${marker}\`, this run is for \`${headSha}\` — leaving the queue untouched.`,
|
|
185
|
+
);
|
|
159
186
|
setStepOutput("release", "false");
|
|
160
187
|
return;
|
|
161
188
|
}
|
|
@@ -163,11 +190,18 @@ export const githubQueuedGuardJob = async (
|
|
|
163
190
|
// this run, whatever its outcome
|
|
164
191
|
await git("push", "origin", `:${QUEUE_MARKER_REF}`);
|
|
165
192
|
if (conclusion !== "success") {
|
|
193
|
+
appendStepSummary(
|
|
194
|
+
`❌ Queued release for \`${headSha}\` **not executed**: the main workflow concluded **${conclusion}**. ` +
|
|
195
|
+
`Fix the pipeline and queue again via the 🚀 create release workflow.`,
|
|
196
|
+
);
|
|
166
197
|
fail(
|
|
167
198
|
`queued release not executed: the main workflow concluded '${conclusion}' — ` +
|
|
168
|
-
`fix the pipeline and queue
|
|
199
|
+
`fix the pipeline and queue the release again`,
|
|
169
200
|
);
|
|
170
201
|
}
|
|
171
202
|
console.log(`main workflow for ${headSha} succeeded — releasing`);
|
|
203
|
+
appendStepSummary(
|
|
204
|
+
`✅ Main workflow for \`${headSha}\` succeeded — running the queued release.`,
|
|
205
|
+
);
|
|
172
206
|
setStepOutput("release", "true");
|
|
173
207
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* github step summaries: markdown shown on the run page, so a run
|
|
3
|
+
* explains what happened without reading job logs. No-op outside
|
|
4
|
+
* github actions (GITHUB_STEP_SUMMARY unset, e.g. on gitlab).
|
|
5
|
+
*/
|
|
6
|
+
import { appendFileSync } from "fs";
|
|
7
|
+
|
|
8
|
+
export const appendStepSummary = (markdown: string) => {
|
|
9
|
+
const file = process.env.GITHUB_STEP_SUMMARY;
|
|
10
|
+
if (!file) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
appendFileSync(file, markdown + "\n");
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* link to a generated workflow's run list (e.g.
|
|
18
|
+
* `workflowLink("catladder-main.yml", "catladder main")`)
|
|
19
|
+
*/
|
|
20
|
+
export const workflowLink = (fileName: string, label: string): string => {
|
|
21
|
+
const server = process.env.GITHUB_SERVER_URL ?? "https://github.com";
|
|
22
|
+
const repository = process.env.GITHUB_REPOSITORY;
|
|
23
|
+
if (!repository) {
|
|
24
|
+
return label;
|
|
25
|
+
}
|
|
26
|
+
return `[${label}](${server}/${repository}/actions/workflows/${fileName})`;
|
|
27
|
+
};
|