Skip to content

Commit a75bdd3

Browse files
committed
Use rc instead of beta
1 parent c9d3057 commit a75bdd3

File tree

7 files changed

+57
-57
lines changed

7 files changed

+57
-57
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ outputs:
7777
description: 'Output of is_package_json_version_upgraded, string'
7878
is_upgraded_version:
7979
description: 'Output of is_package_json_version_upgraded, true|false'
80-
is_release_beta:
80+
is_pre_release:
8181
description: 'Output of is_package_json_version_upgraded, true|false'
8282
runs:
8383
using: 'node16'

dist/index.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5420,21 +5420,21 @@ exports.NpmModuleVersion = void 0;
54205420
var NpmModuleVersion;
54215421
(function (NpmModuleVersion) {
54225422
function parse(versionStr) {
5423-
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-beta.([0-9]+))?/);
5423+
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-rc.([0-9]+))?/);
54245424
if (!match) {
54255425
throw new Error(`${versionStr} is not a valid NPM version`);
54265426
}
54275427
return Object.assign({ "major": parseInt(match[1]), "minor": parseInt(match[2]), "patch": parseInt(match[3]) }, (() => {
54285428
const str = match[4];
54295429
return str === undefined ?
54305430
{} :
5431-
{ "betaPreRelease": parseInt(str) };
5431+
{ "rc": parseInt(str) };
54325432
})());
54335433
}
54345434
NpmModuleVersion.parse = parse;
54355435
;
54365436
function stringify(v) {
5437-
return `${v.major}.${v.minor}.${v.patch}${v.betaPreRelease === undefined ? "" : `-beta.${v.betaPreRelease}`}`;
5437+
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
54385438
}
54395439
NpmModuleVersion.stringify = stringify;
54405440
/**
@@ -5447,7 +5447,7 @@ var NpmModuleVersion;
54475447
function compare(v1, v2) {
54485448
const sign = (diff) => diff === 0 ? 0 : (diff < 0 ? -1 : 1);
54495449
const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
5450-
for (const level of ["major", "minor", "patch", "betaPreRelease"]) {
5450+
for (const level of ["major", "minor", "patch", "rc"]) {
54515451
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
54525452
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
54535453
}
@@ -5456,17 +5456,17 @@ var NpmModuleVersion;
54565456
}
54575457
NpmModuleVersion.compare = compare;
54585458
/*
5459-
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0")) === -1 )
5460-
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0-beta.4")) === -1 )
5461-
console.log(compare(parse("3.0.0-beta.3"), parse("4.0.0")) === -1 )
5459+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
5460+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
5461+
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
54625462
*/
54635463
function bumpType(params) {
54645464
const versionAhead = parse(params.versionAheadStr);
54655465
const versionBehind = parse(params.versionBehindStr);
54665466
if (compare(versionBehind, versionAhead) === 1) {
54675467
throw new Error(`Version regression ${versionBehind} -> ${versionAhead}`);
54685468
}
5469-
for (const level of ["major", "minor", "patch", "betaPreRelease"]) {
5469+
for (const level of ["major", "minor", "patch", "rc"]) {
54705470
if (versionBehind[level] !== versionAhead[level]) {
54715471
return level;
54725472
}
@@ -9673,7 +9673,7 @@ function getLatestSemVersionedTagFactory(params) {
96739673
function getLatestSemVersionedTag(params) {
96749674
var e_1, _a;
96759675
return __awaiter(this, void 0, void 0, function* () {
9676-
const { owner, repo, beta, major } = params;
9676+
const { owner, repo, rcPolicy, major } = params;
96779677
const semVersionedTags = [];
96789678
const { listTags } = listTags_1.listTagsFactory({ octokit });
96799679
try {
@@ -9689,17 +9689,17 @@ function getLatestSemVersionedTagFactory(params) {
96899689
catch (_d) {
96909690
continue;
96919691
}
9692-
switch (beta) {
9693-
case "IGNORE BETA":
9694-
if (version.betaPreRelease !== undefined) {
9692+
switch (rcPolicy) {
9693+
case "IGNORE RC":
9694+
if (version.rc !== undefined) {
96959695
continue;
96969696
}
96979697
break;
9698-
case "ONLY LOOK FOR BETA":
9699-
if (version.betaPreRelease === undefined) {
9698+
case "ONLY LOOK FOR RC":
9699+
if (version.rc === undefined) {
97009700
continue;
97019701
}
9702-
case "BETA OR REGULAR RELEASE":
9702+
case "RC OR REGULAR RELEASE":
97039703
break;
97049704
}
97059705
semVersionedTags.push({ tag, version });
@@ -11287,7 +11287,7 @@ function action(_actionName, params, core) {
1128711287
const octokit = createOctokit_1.createOctokit({ github_token });
1128811288
const { getCommitAhead } = getCommitAhead_1.getCommitAheadFactory({ octokit });
1128911289
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
11290-
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined }))) !== null && _a !== void 0 ? _a : {};
11290+
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "rcPolicy": "IGNORE RC", "major": undefined }))) !== null && _a !== void 0 ? _a : {};
1129111291
if (branchBehind === undefined) {
1129211292
core.warning(`It's the first release, not editing the CHANGELOG.md`);
1129311293
return;
@@ -11309,15 +11309,15 @@ function action(_actionName, params, core) {
1130911309
branch,
1131011310
"compare_to_version": "0.0.0"
1131111311
}, core).then(({ version }) => version)));
11312-
if (NpmModuleVersion_1.NpmModuleVersion.parse(branchAheadVersion).betaPreRelease !== undefined) {
11313-
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a beta release, we do not update the CHANGELOG.md`);
11312+
if (NpmModuleVersion_1.NpmModuleVersion.parse(branchAheadVersion).rc !== undefined) {
11313+
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a release candidate, we do not update the CHANGELOG.md`);
1131411314
return;
1131511315
}
1131611316
const bumpType = NpmModuleVersion_1.NpmModuleVersion.bumpType({
1131711317
"versionAheadStr": branchAheadVersion,
1131811318
"versionBehindStr": branchBehindVersion || "0.0.0"
1131911319
});
11320-
assert_1.assert(bumpType !== "betaPreRelease");
11320+
assert_1.assert(bumpType !== "rc");
1132111321
if (bumpType === "same") {
1132211322
core.warning(`Version on ${branch} and ${branchBehind} are the same, not editing CHANGELOG.md`);
1132311323
return;
@@ -12287,7 +12287,7 @@ exports.outputNames = [
1228712287
"from_version",
1228812288
"to_version",
1228912289
"is_upgraded_version",
12290-
"is_release_beta"
12290+
"is_pre_release"
1229112291
];
1229212292
function getOutputDescription(inputName) {
1229312293
switch (inputName) {
@@ -12304,7 +12304,7 @@ function getOutputDescription(inputName) {
1230412304
case "from_version": return "Output of is_package_json_version_upgraded, string";
1230512305
case "to_version": return "Output of is_package_json_version_upgraded, string";
1230612306
case "is_upgraded_version": return "Output of is_package_json_version_upgraded, true|false";
12307-
case "is_release_beta": return "Output of is_package_json_version_upgraded, true|false";
12307+
case "is_pre_release": return "Output of is_package_json_version_upgraded, true|false";
1230812308
}
1230912309
}
1231012310
exports.getOutputDescription = getOutputDescription;
@@ -14651,8 +14651,8 @@ function action(_actionName, params, core) {
1465114651
const getLatestSemVersionedTagParam = {
1465214652
owner,
1465314653
repo,
14654-
"beta": to_version.betaPreRelease !== undefined ?
14655-
"ONLY LOOK FOR BETA" : "IGNORE BETA",
14654+
"rcPolicy": to_version.rc !== undefined ?
14655+
"ONLY LOOK FOR RC" : "IGNORE RC",
1465614656
"major": to_version.major
1465714657
};
1465814658
let wrap = yield getLatestSemVersionedTag(getLatestSemVersionedTagParam);
@@ -14668,13 +14668,13 @@ function action(_actionName, params, core) {
1466814668
core.debug(`Last version was ${NpmModuleVersion_1.NpmModuleVersion.stringify(from_version)}`);
1466914669
const is_upgraded_version = NpmModuleVersion_1.NpmModuleVersion.compare(to_version, from_version) === 1 ? "true" : "false";
1467014670
core.debug(`Is version upgraded: ${is_upgraded_version}`);
14671-
const is_release_beta = is_upgraded_version === "false" ? "false" : to_version.betaPreRelease !== undefined ? "true" : "false";
14672-
core.debug(`Is release beta: ${is_release_beta}`);
14671+
const is_pre_release = is_upgraded_version === "false" ? "false" : to_version.rc !== undefined ? "true" : "false";
14672+
core.debug(`Is pre release: ${is_pre_release}`);
1467314673
return {
1467414674
"to_version": NpmModuleVersion_1.NpmModuleVersion.stringify(to_version),
1467514675
"from_version": NpmModuleVersion_1.NpmModuleVersion.stringify(from_version),
1467614676
is_upgraded_version,
14677-
is_release_beta
14677+
is_pre_release
1467814678
};
1467914679
});
1468014680
}

src/is_package_json_version_upgraded.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type CoreLike = {
2424
debug: (message: string) => void;
2525
};
2626

27-
export const { setOutput } = setOutputFactory<"from_version" | "to_version" | "is_upgraded_version" | "is_release_beta">();
27+
export const { setOutput } = setOutputFactory<"from_version" | "to_version" | "is_upgraded_version" | "is_pre_release">();
2828

2929
export async function action(
3030
_actionName: "is_package_json_version_upgraded",
@@ -59,8 +59,8 @@ export async function action(
5959
const getLatestSemVersionedTagParam: Param0<typeof getLatestSemVersionedTag> = {
6060
owner,
6161
repo,
62-
"beta": to_version.betaPreRelease !== undefined ?
63-
"ONLY LOOK FOR BETA" : "IGNORE BETA",
62+
"rcPolicy": to_version.rc !== undefined ?
63+
"ONLY LOOK FOR RC" : "IGNORE RC",
6464
"major": to_version.major
6565
};
6666

@@ -89,15 +89,15 @@ export async function action(
8989

9090
core.debug(`Is version upgraded: ${is_upgraded_version}`);
9191

92-
const is_release_beta = is_upgraded_version === "false" ? "false" : to_version.betaPreRelease !== undefined ? "true" : "false";
92+
const is_pre_release = is_upgraded_version === "false" ? "false" : to_version.rc !== undefined ? "true" : "false";
9393

94-
core.debug(`Is release beta: ${is_release_beta}`);
94+
core.debug(`Is pre release: ${is_pre_release}`);
9595

9696
return {
9797
"to_version": NpmModuleVersion.stringify(to_version),
9898
"from_version": NpmModuleVersion.stringify(from_version),
9999
is_upgraded_version,
100-
is_release_beta
100+
is_pre_release
101101
};
102102

103103
}

src/outputHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const outputNames = [
1616
"from_version",
1717
"to_version",
1818
"is_upgraded_version",
19-
"is_release_beta"
19+
"is_pre_release"
2020
] as const;
2121

2222

@@ -35,7 +35,7 @@ export function getOutputDescription(inputName: typeof outputNames[number]): str
3535
case "from_version": return "Output of is_package_json_version_upgraded, string";
3636
case "to_version": return "Output of is_package_json_version_upgraded, string";
3737
case "is_upgraded_version": return "Output of is_package_json_version_upgraded, true|false";
38-
case "is_release_beta": return "Output of is_package_json_version_upgraded, true|false";
38+
case "is_pre_release": return "Output of is_package_json_version_upgraded, true|false";
3939
}
4040
}
4141

src/tools/NpmModuleVersion.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ export type NpmModuleVersion = {
44
major: number;
55
minor: number;
66
patch: number;
7-
betaPreRelease?: number;
7+
rc?: number;
88
};
99

1010
export namespace NpmModuleVersion {
1111

1212
export function parse(versionStr: string): NpmModuleVersion {
1313

14-
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-beta.([0-9]+))?/);
14+
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-rc.([0-9]+))?/);
1515

1616
if (!match) {
1717
throw new Error(`${versionStr} is not a valid NPM version`);
@@ -26,15 +26,15 @@ export namespace NpmModuleVersion {
2626
const str = match[4];
2727
return str === undefined ?
2828
{} :
29-
{ "betaPreRelease": parseInt(str) };
29+
{ "rc": parseInt(str) };
3030

3131
})()
3232
};
3333

3434
};
3535

3636
export function stringify(v: NpmModuleVersion) {
37-
return `${v.major}.${v.minor}.${v.patch}${v.betaPreRelease === undefined ? "" : `-beta.${v.betaPreRelease}`}`;
37+
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
3838
}
3939

4040
/**
@@ -49,7 +49,7 @@ export namespace NpmModuleVersion {
4949
const sign = (diff: number): -1 | 0 | 1 => diff === 0 ? 0 : (diff < 0 ? -1 : 1);
5050
const noUndefined= (n: number | undefined)=> n ?? Infinity;
5151

52-
for (const level of ["major", "minor", "patch", "betaPreRelease"] as const) {
52+
for (const level of ["major", "minor", "patch", "rc"] as const) {
5353
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
5454
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
5555
}
@@ -60,17 +60,17 @@ export namespace NpmModuleVersion {
6060
}
6161

6262
/*
63-
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0")) === -1 )
64-
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0-beta.4")) === -1 )
65-
console.log(compare(parse("3.0.0-beta.3"), parse("4.0.0")) === -1 )
63+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
64+
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
65+
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
6666
*/
6767

6868
export function bumpType(
6969
params: {
7070
versionBehindStr: string;
7171
versionAheadStr: string;
7272
}
73-
): "major" | "minor" | "patch" | "betaPreRelease" | "same" {
73+
): "major" | "minor" | "patch" | "rc" | "same" {
7474

7575

7676
const versionAhead = parse(params.versionAheadStr);
@@ -80,7 +80,7 @@ export namespace NpmModuleVersion {
8080
throw new Error(`Version regression ${versionBehind} -> ${versionAhead}`);
8181
}
8282

83-
for (const level of ["major", "minor", "patch", "betaPreRelease"] as const) {
83+
for (const level of ["major", "minor", "patch", "rc"] as const) {
8484
if (versionBehind[level] !== versionAhead[level]) {
8585
return level;
8686
}

src/tools/octokit-addons/getLatestSemVersionedTag.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
1111
params: {
1212
owner: string;
1313
repo: string;
14-
beta: "ONLY LOOK FOR BETA" | "IGNORE BETA" | "BETA OR REGULAR RELEASE";
14+
rcPolicy: "ONLY LOOK FOR RC" | "IGNORE RC" | "RC OR REGULAR RELEASE";
1515
major: number | undefined;
1616
}
1717
): Promise<{
1818
tag: string;
1919
version: NpmModuleVersion;
2020
} | undefined> {
2121

22-
const { owner, repo, beta, major } = params;
22+
const { owner, repo, rcPolicy, major } = params;
2323

2424
const semVersionedTags: { tag: string; version: NpmModuleVersion; }[] = [];
2525

@@ -41,17 +41,17 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
4141
continue;
4242
}
4343

44-
switch (beta) {
45-
case "IGNORE BETA":
46-
if (version.betaPreRelease !== undefined) {
44+
switch (rcPolicy) {
45+
case "IGNORE RC":
46+
if (version.rc !== undefined) {
4747
continue;
4848
}
4949
break;
50-
case "ONLY LOOK FOR BETA":
51-
if (version.betaPreRelease === undefined) {
50+
case "ONLY LOOK FOR RC":
51+
if (version.rc === undefined) {
5252
continue;
5353
}
54-
case "BETA OR REGULAR RELEASE":
54+
case "RC OR REGULAR RELEASE":
5555
break;
5656
}
5757

src/update_changelog.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function action(
5757

5858
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
5959

60-
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined })) ?? {};
60+
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "rcPolicy": "IGNORE RC", "major": undefined })) ?? {};
6161

6262
if( branchBehind === undefined ){
6363

@@ -101,9 +101,9 @@ export async function action(
101101
)
102102
);
103103

104-
if( NpmModuleVersion.parse(branchAheadVersion).betaPreRelease !== undefined ){
104+
if( NpmModuleVersion.parse(branchAheadVersion).rc !== undefined ){
105105

106-
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a beta release, we do not update the CHANGELOG.md`);
106+
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a release candidate, we do not update the CHANGELOG.md`);
107107

108108
return;
109109

@@ -114,7 +114,7 @@ export async function action(
114114
"versionBehindStr": branchBehindVersion || "0.0.0"
115115
});
116116

117-
assert(bumpType !== "betaPreRelease");
117+
assert(bumpType !== "rc");
118118

119119
if( bumpType === "same" ){
120120

0 commit comments

Comments
 (0)