mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
Use rc instead of beta
This commit is contained in:
parent
c9d3057053
commit
a75bdd36de
7 changed files with 57 additions and 57 deletions
|
|
@ -77,7 +77,7 @@ outputs:
|
|||
description: 'Output of is_package_json_version_upgraded, string'
|
||||
is_upgraded_version:
|
||||
description: 'Output of is_package_json_version_upgraded, true|false'
|
||||
is_release_beta:
|
||||
is_pre_release:
|
||||
description: 'Output of is_package_json_version_upgraded, true|false'
|
||||
runs:
|
||||
using: 'node16'
|
||||
|
|
|
|||
52
dist/index.js
vendored
52
dist/index.js
vendored
|
|
@ -5420,7 +5420,7 @@ exports.NpmModuleVersion = void 0;
|
|||
var NpmModuleVersion;
|
||||
(function (NpmModuleVersion) {
|
||||
function parse(versionStr) {
|
||||
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-beta.([0-9]+))?/);
|
||||
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-rc.([0-9]+))?/);
|
||||
if (!match) {
|
||||
throw new Error(`${versionStr} is not a valid NPM version`);
|
||||
}
|
||||
|
|
@ -5428,13 +5428,13 @@ var NpmModuleVersion;
|
|||
const str = match[4];
|
||||
return str === undefined ?
|
||||
{} :
|
||||
{ "betaPreRelease": parseInt(str) };
|
||||
{ "rc": parseInt(str) };
|
||||
})());
|
||||
}
|
||||
NpmModuleVersion.parse = parse;
|
||||
;
|
||||
function stringify(v) {
|
||||
return `${v.major}.${v.minor}.${v.patch}${v.betaPreRelease === undefined ? "" : `-beta.${v.betaPreRelease}`}`;
|
||||
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
|
||||
}
|
||||
NpmModuleVersion.stringify = stringify;
|
||||
/**
|
||||
|
|
@ -5447,7 +5447,7 @@ var NpmModuleVersion;
|
|||
function compare(v1, v2) {
|
||||
const sign = (diff) => diff === 0 ? 0 : (diff < 0 ? -1 : 1);
|
||||
const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
|
||||
for (const level of ["major", "minor", "patch", "betaPreRelease"]) {
|
||||
for (const level of ["major", "minor", "patch", "rc"]) {
|
||||
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
|
||||
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
|
||||
}
|
||||
|
|
@ -5456,9 +5456,9 @@ var NpmModuleVersion;
|
|||
}
|
||||
NpmModuleVersion.compare = compare;
|
||||
/*
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0-beta.4")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("4.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
|
||||
*/
|
||||
function bumpType(params) {
|
||||
const versionAhead = parse(params.versionAheadStr);
|
||||
|
|
@ -5466,7 +5466,7 @@ var NpmModuleVersion;
|
|||
if (compare(versionBehind, versionAhead) === 1) {
|
||||
throw new Error(`Version regression ${versionBehind} -> ${versionAhead}`);
|
||||
}
|
||||
for (const level of ["major", "minor", "patch", "betaPreRelease"]) {
|
||||
for (const level of ["major", "minor", "patch", "rc"]) {
|
||||
if (versionBehind[level] !== versionAhead[level]) {
|
||||
return level;
|
||||
}
|
||||
|
|
@ -9673,7 +9673,7 @@ function getLatestSemVersionedTagFactory(params) {
|
|||
function getLatestSemVersionedTag(params) {
|
||||
var e_1, _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { owner, repo, beta, major } = params;
|
||||
const { owner, repo, rcPolicy, major } = params;
|
||||
const semVersionedTags = [];
|
||||
const { listTags } = listTags_1.listTagsFactory({ octokit });
|
||||
try {
|
||||
|
|
@ -9689,17 +9689,17 @@ function getLatestSemVersionedTagFactory(params) {
|
|||
catch (_d) {
|
||||
continue;
|
||||
}
|
||||
switch (beta) {
|
||||
case "IGNORE BETA":
|
||||
if (version.betaPreRelease !== undefined) {
|
||||
switch (rcPolicy) {
|
||||
case "IGNORE RC":
|
||||
if (version.rc !== undefined) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case "ONLY LOOK FOR BETA":
|
||||
if (version.betaPreRelease === undefined) {
|
||||
case "ONLY LOOK FOR RC":
|
||||
if (version.rc === undefined) {
|
||||
continue;
|
||||
}
|
||||
case "BETA OR REGULAR RELEASE":
|
||||
case "RC OR REGULAR RELEASE":
|
||||
break;
|
||||
}
|
||||
semVersionedTags.push({ tag, version });
|
||||
|
|
@ -11287,7 +11287,7 @@ function action(_actionName, params, core) {
|
|||
const octokit = createOctokit_1.createOctokit({ github_token });
|
||||
const { getCommitAhead } = getCommitAhead_1.getCommitAheadFactory({ octokit });
|
||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
||||
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined }))) !== null && _a !== void 0 ? _a : {};
|
||||
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "rcPolicy": "IGNORE RC", "major": undefined }))) !== null && _a !== void 0 ? _a : {};
|
||||
if (branchBehind === undefined) {
|
||||
core.warning(`It's the first release, not editing the CHANGELOG.md`);
|
||||
return;
|
||||
|
|
@ -11309,15 +11309,15 @@ function action(_actionName, params, core) {
|
|||
branch,
|
||||
"compare_to_version": "0.0.0"
|
||||
}, core).then(({ version }) => version)));
|
||||
if (NpmModuleVersion_1.NpmModuleVersion.parse(branchAheadVersion).betaPreRelease !== undefined) {
|
||||
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a beta release, we do not update the CHANGELOG.md`);
|
||||
if (NpmModuleVersion_1.NpmModuleVersion.parse(branchAheadVersion).rc !== undefined) {
|
||||
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a release candidate, we do not update the CHANGELOG.md`);
|
||||
return;
|
||||
}
|
||||
const bumpType = NpmModuleVersion_1.NpmModuleVersion.bumpType({
|
||||
"versionAheadStr": branchAheadVersion,
|
||||
"versionBehindStr": branchBehindVersion || "0.0.0"
|
||||
});
|
||||
assert_1.assert(bumpType !== "betaPreRelease");
|
||||
assert_1.assert(bumpType !== "rc");
|
||||
if (bumpType === "same") {
|
||||
core.warning(`Version on ${branch} and ${branchBehind} are the same, not editing CHANGELOG.md`);
|
||||
return;
|
||||
|
|
@ -12287,7 +12287,7 @@ exports.outputNames = [
|
|||
"from_version",
|
||||
"to_version",
|
||||
"is_upgraded_version",
|
||||
"is_release_beta"
|
||||
"is_pre_release"
|
||||
];
|
||||
function getOutputDescription(inputName) {
|
||||
switch (inputName) {
|
||||
|
|
@ -12304,7 +12304,7 @@ function getOutputDescription(inputName) {
|
|||
case "from_version": return "Output of is_package_json_version_upgraded, string";
|
||||
case "to_version": return "Output of is_package_json_version_upgraded, string";
|
||||
case "is_upgraded_version": return "Output of is_package_json_version_upgraded, true|false";
|
||||
case "is_release_beta": return "Output of is_package_json_version_upgraded, true|false";
|
||||
case "is_pre_release": return "Output of is_package_json_version_upgraded, true|false";
|
||||
}
|
||||
}
|
||||
exports.getOutputDescription = getOutputDescription;
|
||||
|
|
@ -14651,8 +14651,8 @@ function action(_actionName, params, core) {
|
|||
const getLatestSemVersionedTagParam = {
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA",
|
||||
"rcPolicy": to_version.rc !== undefined ?
|
||||
"ONLY LOOK FOR RC" : "IGNORE RC",
|
||||
"major": to_version.major
|
||||
};
|
||||
let wrap = yield getLatestSemVersionedTag(getLatestSemVersionedTagParam);
|
||||
|
|
@ -14668,13 +14668,13 @@ function action(_actionName, params, core) {
|
|||
core.debug(`Last version was ${NpmModuleVersion_1.NpmModuleVersion.stringify(from_version)}`);
|
||||
const is_upgraded_version = NpmModuleVersion_1.NpmModuleVersion.compare(to_version, from_version) === 1 ? "true" : "false";
|
||||
core.debug(`Is version upgraded: ${is_upgraded_version}`);
|
||||
const is_release_beta = is_upgraded_version === "false" ? "false" : to_version.betaPreRelease !== undefined ? "true" : "false";
|
||||
core.debug(`Is release beta: ${is_release_beta}`);
|
||||
const is_pre_release = is_upgraded_version === "false" ? "false" : to_version.rc !== undefined ? "true" : "false";
|
||||
core.debug(`Is pre release: ${is_pre_release}`);
|
||||
return {
|
||||
"to_version": NpmModuleVersion_1.NpmModuleVersion.stringify(to_version),
|
||||
"from_version": NpmModuleVersion_1.NpmModuleVersion.stringify(from_version),
|
||||
is_upgraded_version,
|
||||
is_release_beta
|
||||
is_pre_release
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type CoreLike = {
|
|||
debug: (message: string) => void;
|
||||
};
|
||||
|
||||
export const { setOutput } = setOutputFactory<"from_version" | "to_version" | "is_upgraded_version" | "is_release_beta">();
|
||||
export const { setOutput } = setOutputFactory<"from_version" | "to_version" | "is_upgraded_version" | "is_pre_release">();
|
||||
|
||||
export async function action(
|
||||
_actionName: "is_package_json_version_upgraded",
|
||||
|
|
@ -59,8 +59,8 @@ export async function action(
|
|||
const getLatestSemVersionedTagParam: Param0<typeof getLatestSemVersionedTag> = {
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA",
|
||||
"rcPolicy": to_version.rc !== undefined ?
|
||||
"ONLY LOOK FOR RC" : "IGNORE RC",
|
||||
"major": to_version.major
|
||||
};
|
||||
|
||||
|
|
@ -89,15 +89,15 @@ export async function action(
|
|||
|
||||
core.debug(`Is version upgraded: ${is_upgraded_version}`);
|
||||
|
||||
const is_release_beta = is_upgraded_version === "false" ? "false" : to_version.betaPreRelease !== undefined ? "true" : "false";
|
||||
const is_pre_release = is_upgraded_version === "false" ? "false" : to_version.rc !== undefined ? "true" : "false";
|
||||
|
||||
core.debug(`Is release beta: ${is_release_beta}`);
|
||||
core.debug(`Is pre release: ${is_pre_release}`);
|
||||
|
||||
return {
|
||||
"to_version": NpmModuleVersion.stringify(to_version),
|
||||
"from_version": NpmModuleVersion.stringify(from_version),
|
||||
is_upgraded_version,
|
||||
is_release_beta
|
||||
is_pre_release
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const outputNames = [
|
|||
"from_version",
|
||||
"to_version",
|
||||
"is_upgraded_version",
|
||||
"is_release_beta"
|
||||
"is_pre_release"
|
||||
] as const;
|
||||
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ export function getOutputDescription(inputName: typeof outputNames[number]): str
|
|||
case "from_version": return "Output of is_package_json_version_upgraded, string";
|
||||
case "to_version": return "Output of is_package_json_version_upgraded, string";
|
||||
case "is_upgraded_version": return "Output of is_package_json_version_upgraded, true|false";
|
||||
case "is_release_beta": return "Output of is_package_json_version_upgraded, true|false";
|
||||
case "is_pre_release": return "Output of is_package_json_version_upgraded, true|false";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ export type NpmModuleVersion = {
|
|||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
betaPreRelease?: number;
|
||||
rc?: number;
|
||||
};
|
||||
|
||||
export namespace NpmModuleVersion {
|
||||
|
||||
export function parse(versionStr: string): NpmModuleVersion {
|
||||
|
||||
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-beta.([0-9]+))?/);
|
||||
const match = versionStr.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-rc.([0-9]+))?/);
|
||||
|
||||
if (!match) {
|
||||
throw new Error(`${versionStr} is not a valid NPM version`);
|
||||
|
|
@ -26,7 +26,7 @@ export namespace NpmModuleVersion {
|
|||
const str = match[4];
|
||||
return str === undefined ?
|
||||
{} :
|
||||
{ "betaPreRelease": parseInt(str) };
|
||||
{ "rc": parseInt(str) };
|
||||
|
||||
})()
|
||||
};
|
||||
|
|
@ -34,7 +34,7 @@ export namespace NpmModuleVersion {
|
|||
};
|
||||
|
||||
export function stringify(v: NpmModuleVersion) {
|
||||
return `${v.major}.${v.minor}.${v.patch}${v.betaPreRelease === undefined ? "" : `-beta.${v.betaPreRelease}`}`;
|
||||
return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +49,7 @@ export namespace NpmModuleVersion {
|
|||
const sign = (diff: number): -1 | 0 | 1 => diff === 0 ? 0 : (diff < 0 ? -1 : 1);
|
||||
const noUndefined= (n: number | undefined)=> n ?? Infinity;
|
||||
|
||||
for (const level of ["major", "minor", "patch", "betaPreRelease"] as const) {
|
||||
for (const level of ["major", "minor", "patch", "rc"] as const) {
|
||||
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
|
||||
return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
|
||||
}
|
||||
|
|
@ -60,9 +60,9 @@ export namespace NpmModuleVersion {
|
|||
}
|
||||
|
||||
/*
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0-beta.4")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("4.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
|
||||
console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
|
||||
*/
|
||||
|
||||
export function bumpType(
|
||||
|
|
@ -70,7 +70,7 @@ export namespace NpmModuleVersion {
|
|||
versionBehindStr: string;
|
||||
versionAheadStr: string;
|
||||
}
|
||||
): "major" | "minor" | "patch" | "betaPreRelease" | "same" {
|
||||
): "major" | "minor" | "patch" | "rc" | "same" {
|
||||
|
||||
|
||||
const versionAhead = parse(params.versionAheadStr);
|
||||
|
|
@ -80,7 +80,7 @@ export namespace NpmModuleVersion {
|
|||
throw new Error(`Version regression ${versionBehind} -> ${versionAhead}`);
|
||||
}
|
||||
|
||||
for (const level of ["major", "minor", "patch", "betaPreRelease"] as const) {
|
||||
for (const level of ["major", "minor", "patch", "rc"] as const) {
|
||||
if (versionBehind[level] !== versionAhead[level]) {
|
||||
return level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
|||
params: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
beta: "ONLY LOOK FOR BETA" | "IGNORE BETA" | "BETA OR REGULAR RELEASE";
|
||||
rcPolicy: "ONLY LOOK FOR RC" | "IGNORE RC" | "RC OR REGULAR RELEASE";
|
||||
major: number | undefined;
|
||||
}
|
||||
): Promise<{
|
||||
|
|
@ -19,7 +19,7 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
|||
version: NpmModuleVersion;
|
||||
} | undefined> {
|
||||
|
||||
const { owner, repo, beta, major } = params;
|
||||
const { owner, repo, rcPolicy, major } = params;
|
||||
|
||||
const semVersionedTags: { tag: string; version: NpmModuleVersion; }[] = [];
|
||||
|
||||
|
|
@ -41,17 +41,17 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
|||
continue;
|
||||
}
|
||||
|
||||
switch (beta) {
|
||||
case "IGNORE BETA":
|
||||
if (version.betaPreRelease !== undefined) {
|
||||
switch (rcPolicy) {
|
||||
case "IGNORE RC":
|
||||
if (version.rc !== undefined) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case "ONLY LOOK FOR BETA":
|
||||
if (version.betaPreRelease === undefined) {
|
||||
case "ONLY LOOK FOR RC":
|
||||
if (version.rc === undefined) {
|
||||
continue;
|
||||
}
|
||||
case "BETA OR REGULAR RELEASE":
|
||||
case "RC OR REGULAR RELEASE":
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export async function action(
|
|||
|
||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
||||
|
||||
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined })) ?? {};
|
||||
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "rcPolicy": "IGNORE RC", "major": undefined })) ?? {};
|
||||
|
||||
if( branchBehind === undefined ){
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ export async function action(
|
|||
)
|
||||
);
|
||||
|
||||
if( NpmModuleVersion.parse(branchAheadVersion).betaPreRelease !== undefined ){
|
||||
if( NpmModuleVersion.parse(branchAheadVersion).rc !== undefined ){
|
||||
|
||||
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a beta release, we do not update the CHANGELOG.md`);
|
||||
core.warning(`Version on ${branch} is ${branchAheadVersion} it's a release candidate, we do not update the CHANGELOG.md`);
|
||||
|
||||
return;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ export async function action(
|
|||
"versionBehindStr": branchBehindVersion || "0.0.0"
|
||||
});
|
||||
|
||||
assert(bumpType !== "betaPreRelease");
|
||||
assert(bumpType !== "rc");
|
||||
|
||||
if( bumpType === "same" ){
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue