@kungfu-tech/buildchain 2.0.13-alpha.9 → 2.0.14-alpha.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungfu-tech/buildchain",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Kungfu Buildchain reusable workflows, release governance, and CLI tooling.",
|
|
6
6
|
"repository": "https://github.com/kungfu-systems/buildchain",
|
|
@@ -45,6 +45,18 @@ export function parseVersionStateRef(ref) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export function parseReleaseLineRecoveryRef(ref) {
|
|
49
|
+
const normalizedRef = normalizeRef(ref);
|
|
50
|
+
const match = normalizedRef.match(/^fix\/release-line-v(\d+)-v(\d+\.\d+)-[0-9A-Za-z._-]+$/);
|
|
51
|
+
if (!match) return undefined;
|
|
52
|
+
return {
|
|
53
|
+
major: Number(match[1]),
|
|
54
|
+
loose: Number(match[2]),
|
|
55
|
+
normalizedRef: `release/v${match[1]}/v${match[2]}`,
|
|
56
|
+
lineSuffix: `/v${match[1]}/v${match[2]}`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
export function getChannel(ref) {
|
|
49
61
|
const versionStateTarget = parseVersionStateRef(ref);
|
|
50
62
|
if (versionStateTarget) return versionStateTarget.channel;
|
|
@@ -85,6 +97,7 @@ export function getBumpKeyword({ cwd = process.cwd(), headRef, baseRef, loose =
|
|
|
85
97
|
const looseVersionNumber = Number(`${version.major}.${version.minor}`);
|
|
86
98
|
const lastLooseVersionNumber = Number((looseVersionNumber - 0.1).toFixed(1));
|
|
87
99
|
const versionStateTarget = parseVersionStateRef(headRef);
|
|
100
|
+
const releaseLineRecoveryTarget = parseReleaseLineRecoveryRef(headRef);
|
|
88
101
|
const headChannel = getChannel(headRef);
|
|
89
102
|
const baseChannel = getChannel(baseRef);
|
|
90
103
|
const key = `${headChannel}->${baseChannel}`;
|
|
@@ -99,6 +112,17 @@ export function getBumpKeyword({ cwd = process.cwd(), headRef, baseRef, loose =
|
|
|
99
112
|
const preminor = headChannel === "release" && lts;
|
|
100
113
|
const majorGate = headChannel === "release" && baseChannel === MAJOR_GATE_CHANNEL;
|
|
101
114
|
|
|
115
|
+
if (releaseLineRecoveryTarget) {
|
|
116
|
+
if (baseChannel !== "release" || releaseLineRecoveryTarget.normalizedRef !== normalizeRef(baseRef)) {
|
|
117
|
+
throw new Error(`Versions not match for head/base refs: ${headRef} -> ${baseRef}`);
|
|
118
|
+
}
|
|
119
|
+
const mismatchMsg = `The version of head ref ${headRef} does not match current ${version.version}`;
|
|
120
|
+
if (releaseLineRecoveryTarget.major !== version.major || releaseLineRecoveryTarget.loose !== looseVersionNumber) {
|
|
121
|
+
throw new Error(mismatchMsg);
|
|
122
|
+
}
|
|
123
|
+
return "patch";
|
|
124
|
+
}
|
|
125
|
+
|
|
102
126
|
if (getLineSuffix(headRef, headChannel) !== getLineSuffix(baseRef, baseChannel) && !preminor && !majorGate) {
|
|
103
127
|
throw new Error(`Versions not match for head/base refs: ${headRef} -> ${baseRef}`);
|
|
104
128
|
}
|