@catladder/cli 0.0.0-next-883523ef → 0.0.0-next-d71e41ba
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/catci.js +12 -0
- package/dist/apps/cli/src/catci.js.map +1 -1
- package/dist/apps/cli/src/release/changesetCheck.d.ts +35 -0
- package/dist/apps/cli/src/release/changesetCheck.js +31 -0
- package/dist/apps/cli/src/release/changesetCheck.js.map +1 -0
- package/dist/apps/cli/src/release/changesetCheckJob.d.ts +2 -0
- package/dist/apps/cli/src/release/changesetCheckJob.js +169 -0
- package/dist/apps/cli/src/release/changesetCheckJob.js.map +1 -0
- package/dist/apps/cli/src/release/changesetsReleaseJob.d.ts +2 -0
- package/dist/apps/cli/src/release/changesetsReleaseJob.js +43 -52
- package/dist/apps/cli/src/release/changesetsReleaseJob.js.map +1 -1
- package/dist/apps/cli/src/release/releaseGit.d.ts +9 -0
- package/dist/apps/cli/src/release/releaseGit.js +49 -0
- package/dist/apps/cli/src/release/releaseGit.js.map +1 -0
- package/dist/bundles/catci/index.js +4 -4
- package/dist/bundles/catenv/index.js +109 -4
- package/dist/bundles/cli/index.js +109 -4
- package/dist/bundles/runner-images/changesets/scripts/changesetCheck +23 -0
- package/dist/bundles/skills/catladder-releases/SKILL.md +31 -2
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +3 -0
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.d.ts +7 -0
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.js +75 -4
- package/dist/packages/pipeline/src/backends/github/githubReleaseJobs.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.d.ts +26 -4
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.js +29 -0
- package/dist/packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.js.map +1 -1
- package/dist/packages/pipeline/src/release/index.d.ts +12 -0
- package/dist/packages/pipeline/src/release/index.js +2 -0
- package/dist/packages/pipeline/src/release/index.js.map +1 -1
- package/dist/packages/pipeline/src/types/github-types.d.ts +1 -0
- package/dist/runner-images/changesets/scripts/changesetCheck +23 -0
- package/dist/skills/catladder-releases/SKILL.md +31 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/catci.ts +14 -0
- package/src/release/__tests__/changesetCheck.test.ts +69 -0
- package/src/release/changesetCheck.ts +82 -0
- package/src/release/changesetCheckJob.ts +199 -0
- package/src/release/changesetsReleaseJob.ts +36 -48
- package/src/release/releaseGit.ts +47 -0
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { JobImagesPlan } from "../../customImages/jobImagesPlan";
|
|
2
2
|
import type { Config } from "../../types/config";
|
|
3
3
|
export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPlan) => {
|
|
4
|
-
"
|
|
4
|
+
"\uD83E\uDD8B changeset check"?: {
|
|
5
5
|
stage: string;
|
|
6
6
|
image: string;
|
|
7
7
|
script: string[];
|
|
8
|
-
|
|
8
|
+
allow_failure: boolean;
|
|
9
|
+
artifacts: {
|
|
10
|
+
paths: string[];
|
|
11
|
+
expose_as: string;
|
|
12
|
+
when: "always";
|
|
13
|
+
};
|
|
9
14
|
rules: {
|
|
10
15
|
if?: string;
|
|
11
16
|
changes?: import("../../types/gitlab-ci-yml").Changes;
|
|
@@ -17,12 +22,11 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
17
22
|
needs?: import("../../types/gitlab-ci-yml").RulesNeeds;
|
|
18
23
|
}[];
|
|
19
24
|
};
|
|
20
|
-
"
|
|
25
|
+
"create release": {
|
|
21
26
|
stage: string;
|
|
22
27
|
image: string;
|
|
23
28
|
script: string[];
|
|
24
29
|
after_script: string[];
|
|
25
|
-
needs: any[];
|
|
26
30
|
rules: {
|
|
27
31
|
if?: string;
|
|
28
32
|
changes?: import("../../types/gitlab-ci-yml").Changes;
|
|
@@ -34,4 +38,22 @@ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPla
|
|
|
34
38
|
needs?: import("../../types/gitlab-ci-yml").RulesNeeds;
|
|
35
39
|
}[];
|
|
36
40
|
};
|
|
41
|
+
"\u26A0\uFE0F force create release": {
|
|
42
|
+
rules: {
|
|
43
|
+
if?: string;
|
|
44
|
+
changes?: import("../../types/gitlab-ci-yml").Changes;
|
|
45
|
+
exists?: import("../../types/gitlab-ci-yml").Exists;
|
|
46
|
+
variables?: import("../../types/gitlab-ci-yml").RulesVariables;
|
|
47
|
+
when?: import("../../types/gitlab-ci-yml").When;
|
|
48
|
+
start_in?: string;
|
|
49
|
+
allow_failure?: import("../../types/gitlab-ci-yml").AllowFailure;
|
|
50
|
+
needs?: import("../../types/gitlab-ci-yml").RulesNeeds;
|
|
51
|
+
}[];
|
|
52
|
+
variables?: Record<string, string>;
|
|
53
|
+
stage: string;
|
|
54
|
+
image: string;
|
|
55
|
+
script: string[];
|
|
56
|
+
after_script: string[];
|
|
57
|
+
needs: any[];
|
|
58
|
+
};
|
|
37
59
|
};
|
|
@@ -44,6 +44,11 @@ const getGitlabReleaseJobs = (config, images) => {
|
|
|
44
44
|
script: [method.script],
|
|
45
45
|
after_script: [EXPIRED_TOKEN_HELP],
|
|
46
46
|
needs: [],
|
|
47
|
+
// force semantics of the method's script (e.g. changesets:
|
|
48
|
+
// release a patch bump even without pending changesets)
|
|
49
|
+
...(method.forceReleaseVariables
|
|
50
|
+
? { variables: method.forceReleaseVariables }
|
|
51
|
+
: {}),
|
|
47
52
|
rules: [
|
|
48
53
|
...baseReleaseRules,
|
|
49
54
|
{
|
|
@@ -56,6 +61,30 @@ const getGitlabReleaseJobs = (config, images) => {
|
|
|
56
61
|
},
|
|
57
62
|
],
|
|
58
63
|
},
|
|
64
|
+
// informational MR check of the release method (e.g. the changeset
|
|
65
|
+
// check): warns via allow_failure, the report lands in the MR
|
|
66
|
+
// widget as an exposed artifact
|
|
67
|
+
...(method.checkScript
|
|
68
|
+
? {
|
|
69
|
+
["🦋 changeset check"]: {
|
|
70
|
+
stage: "test",
|
|
71
|
+
image: releaseImage,
|
|
72
|
+
script: [method.checkScript],
|
|
73
|
+
allow_failure: true,
|
|
74
|
+
artifacts: {
|
|
75
|
+
paths: ["changeset-report.md"],
|
|
76
|
+
expose_as: "changeset report",
|
|
77
|
+
// the report must survive the warning exit
|
|
78
|
+
when: "always",
|
|
79
|
+
},
|
|
80
|
+
rules: [
|
|
81
|
+
rules_1.RULE_NEVER_ON_AGENT_TRIGGER,
|
|
82
|
+
rules_1.RULE_NEVER_ON_SCHEDULE,
|
|
83
|
+
rules_1.RULE_IS_MERGE_REQUEST,
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
: {}),
|
|
59
88
|
};
|
|
60
89
|
};
|
|
61
90
|
exports.getGitlabReleaseJobs = getGitlabReleaseJobs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlabReleaseJobs.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"gitlabReleaseJobs.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/gitlabReleaseJobs.ts"],"names":[],"mappings":";;;AAAA,uCAOqB;AAErB,2CAAiD;AAIjD,MAAM,kBAAkB,GACtB,gJAAgJ,CAAC;AAEnJ,MAAM,gBAAgB,GAAG;IACvB,oCAA4B;IAC5B,mCAA2B;IAC3B,8BAAsB;CACvB,CAAC;AACK,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,MAAqB,EAAE,EAAE;;IAC5E,MAAM,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;IACxC,qEAAqE;IACrE,iEAAiE;IACjE,iEAAiE;IACjE,uEAAuE;IACvE,2CAA2C;IAC3C,MAAM,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BACtB,KAAK,EAAE,MAAM;oBACb,KAAK,EAAE,YAAY;oBACnB,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC;oBAC5B,aAAa,EAAE,IAAI;oBACnB,SAAS,EAAE;wBACT,KAAK,EAAE,CAAC,qBAAqB,CAAC;wBAC9B,SAAS,EAAE,kBAAkB;wBAC7B,2CAA2C;wBAC3C,IAAI,EAAE,QAAiB;qBACxB;oBACD,KAAK,EAAE;wBACL,mCAA2B;wBAC3B,8BAAsB;wBACtB,6BAAqB;qBACC;iBACzB;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC,CAAC;AA5EW,QAAA,oBAAoB,wBA4E/B"}
|
|
@@ -18,6 +18,18 @@ export type ReleaseMethodDefinition = {
|
|
|
18
18
|
* before releasing.
|
|
19
19
|
*/
|
|
20
20
|
script: string;
|
|
21
|
+
/**
|
|
22
|
+
* optional MR/PR check script (on the same image): generates an
|
|
23
|
+
* informational check job in merge-request pipelines (e.g. the
|
|
24
|
+
* changeset check reporting what merging would release)
|
|
25
|
+
*/
|
|
26
|
+
checkScript?: string;
|
|
27
|
+
/**
|
|
28
|
+
* variables injected into the FORCE release jobs only, letting the
|
|
29
|
+
* method's script implement force semantics (e.g. changesets: release
|
|
30
|
+
* a patch bump even without pending changesets)
|
|
31
|
+
*/
|
|
32
|
+
forceReleaseVariables?: Record<string, string>;
|
|
21
33
|
};
|
|
22
34
|
export declare const RELEASE_METHODS: Record<ReleaseMethod, ReleaseMethodDefinition>;
|
|
23
35
|
export declare const getReleaseMethod: (config: Config) => ReleaseMethodDefinition;
|
|
@@ -9,6 +9,8 @@ exports.RELEASE_METHODS = {
|
|
|
9
9
|
changesets: {
|
|
10
10
|
image: "changesets",
|
|
11
11
|
script: "changesetsRelease",
|
|
12
|
+
checkScript: "changesetCheck",
|
|
13
|
+
forceReleaseVariables: { CATLADDER_FORCE_RELEASE: "true" },
|
|
12
14
|
},
|
|
13
15
|
};
|
|
14
16
|
const getReleaseMethod = (config) => { var _a, _b; return exports.RELEASE_METHODS[(_b = (_a = config.releases) === null || _a === void 0 ? void 0 : _a.method) !== null && _b !== void 0 ? _b : "semantic-release"]; };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/release/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/release/index.ts"],"names":[],"mappings":";;;AAmCa,QAAA,eAAe,GAAmD;IAC7E,kBAAkB,EAAE;QAClB,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,iBAAiB;KAC1B;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,mBAAmB;QAC3B,WAAW,EAAE,gBAAgB;QAC7B,qBAAqB,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE;KAC3D;CACF,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAA2B,EAAE,eAC1E,OAAA,uBAAe,CAAC,MAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,MAAM,mCAAI,kBAAkB,CAAC,CAAA,EAAA,CAAC;AADpD,QAAA,gBAAgB,oBACoC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# MR/PR pipelines only: reports which changesets this merge request
|
|
5
|
+
# adds, what is pending and what version merging would release; exits 1
|
|
6
|
+
# (the job runs with allow_failure) when no changeset is added
|
|
7
|
+
|
|
8
|
+
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
|
9
|
+
# github container jobs: the workspace volume is owned by the host
|
|
10
|
+
# runner user while this step runs as the container user, and the
|
|
11
|
+
# safe.directory entry actions/checkout writes goes to a temporary
|
|
12
|
+
# HOME that is gone by now — git would refuse the repo ("dubious
|
|
13
|
+
# ownership")
|
|
14
|
+
git config --global --add safe.directory "$(pwd)"
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
CATCI=".catladder-generated/catci/index.js"
|
|
18
|
+
if [ ! -f "$CATCI" ]; then
|
|
19
|
+
echo "$CATCI not found — regenerate the pipeline with a current catladder version (catenv)"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
node "$CATCI" release changeset-check
|
|
@@ -28,7 +28,10 @@ are generated, never hand-edited.
|
|
|
28
28
|
pipeline (it still no-ops when there is nothing to release).
|
|
29
29
|
|
|
30
30
|
There is always also a manual **`⚠️ force create release`** job as an
|
|
31
|
-
escape hatch.
|
|
31
|
+
escape hatch. With `method: "changesets"` it has an extra meaning: it
|
|
32
|
+
releases **even when no changesets are pending** (patch bump with a
|
|
33
|
+
generic changelog entry) — the recovery path when a change was merged
|
|
34
|
+
without a changeset and must ship now.
|
|
32
35
|
|
|
33
36
|
## `method` — how the version is decided
|
|
34
37
|
|
|
@@ -56,6 +59,31 @@ Add a changeset by creating `.changeset/<name>.md`:
|
|
|
56
59
|
Add the new export endpoint.
|
|
57
60
|
```
|
|
58
61
|
|
|
62
|
+
**When you (an agent) make a user-facing change in a changesets
|
|
63
|
+
project, add a changeset file in the same MR** — bump level `major`
|
|
64
|
+
(breaking) / `minor` (feature) / `patch` (fix), and a one-to-two
|
|
65
|
+
sentence summary written for the changelog reader. Docs/chore-only
|
|
66
|
+
changes need none. The package name in the frontmatter is ignored
|
|
67
|
+
(versions come from git tags); only the bump counts.
|
|
68
|
+
|
|
69
|
+
### The changeset check (MR/PR pipelines)
|
|
70
|
+
|
|
71
|
+
Changesets projects get a **`🦋 changeset check`** job in every
|
|
72
|
+
merge-request pipeline. It reports what merging would do — the
|
|
73
|
+
changesets this MR adds, everything pending, and the version the next
|
|
74
|
+
release would get (with a changelog preview) — and **warns without
|
|
75
|
+
blocking** (`allow_failure`) when the MR adds no changeset:
|
|
76
|
+
|
|
77
|
+
- **GitLab**: report in the job log and as an exposed artifact
|
|
78
|
+
(`changeset-report.md`) in the MR widget. If the project makes
|
|
79
|
+
`GL_TOKEN` available to MR pipelines it also maintains a sticky MR
|
|
80
|
+
comment (opt-in — an api-scope token in MR pipelines is a security
|
|
81
|
+
trade-off).
|
|
82
|
+
- **GitHub**: maintains a sticky PR comment via the workflow token.
|
|
83
|
+
|
|
84
|
+
A yellow changeset-check job on an MR is a prompt to ask: is this
|
|
85
|
+
change user-facing? If yes, add a changeset; if not, ignore it.
|
|
86
|
+
|
|
59
87
|
## The security-audit gate
|
|
60
88
|
|
|
61
89
|
**Both methods gate on a dependency security audit before releasing.**
|
|
@@ -69,7 +97,8 @@ the `security` commands in the `catladder-cli` reference.
|
|
|
69
97
|
|
|
70
98
|
- Fails immediately on the audit → handle the security-audit gate above.
|
|
71
99
|
- `changesets` released nothing → no `.changeset/*.md` files were
|
|
72
|
-
pending.
|
|
100
|
+
pending. To ship anyway, run `⚠️ force create release` (patch bump),
|
|
101
|
+
or merge an MR adding a changeset describing the accumulated work.
|
|
73
102
|
- Wrong version bump → check commit types (semantic-release) or the bump
|
|
74
103
|
levels in the changeset files (changesets).
|
|
75
104
|
- Inspect the job with `yarn catladder project ci job-log` (see the
|