mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
Enable to release update for previous major
This commit is contained in:
parent
6a267b716c
commit
1b498f1789
4 changed files with 60 additions and 21 deletions
32
dist/index.js
vendored
32
dist/index.js
vendored
|
|
@ -7899,7 +7899,7 @@ function getLatestSemVersionedTagFactory(params) {
|
|||
function getLatestSemVersionedTag(params) {
|
||||
var e_1, _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { owner, repo, beta } = params;
|
||||
const { owner, repo, beta, major } = params;
|
||||
const semVersionedTags = [];
|
||||
const { listTags } = listTags_1.listTagsFactory({ octokit });
|
||||
try {
|
||||
|
|
@ -7908,6 +7908,9 @@ function getLatestSemVersionedTagFactory(params) {
|
|||
let version;
|
||||
try {
|
||||
version = NpmModuleVersion_1.NpmModuleVersion.parse(tag.replace(/^[vV]?/, ""));
|
||||
if (major !== undefined && version.major !== major) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (_d) {
|
||||
continue;
|
||||
|
|
@ -9190,7 +9193,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" }))) !== null && _a !== void 0 ? _a : {};
|
||||
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined }))) !== null && _a !== void 0 ? _a : {};
|
||||
if (branchBehind === undefined) {
|
||||
core.warning(`It's the first release, not editing the CHANGELOG.md`);
|
||||
return;
|
||||
|
|
@ -12413,13 +12416,24 @@ function action(_actionName, params, core) {
|
|||
core.debug(`Version on ${owner}/${repo}#${branch} is ${NpmModuleVersion_1.NpmModuleVersion.stringify(to_version)}`);
|
||||
const octokit = createOctokit_1.createOctokit({ github_token });
|
||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
||||
const { version: from_version } = yield getLatestSemVersionedTag({
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA"
|
||||
})
|
||||
.then(wrap => wrap === undefined ? { "version": NpmModuleVersion_1.NpmModuleVersion.parse("0.0.0") } : wrap);
|
||||
const from_version = yield (() => __awaiter(this, void 0, void 0, function* () {
|
||||
const getLatestSemVersionedTagParam = {
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA",
|
||||
"major": to_version.major
|
||||
};
|
||||
let wrap = yield getLatestSemVersionedTag(getLatestSemVersionedTagParam);
|
||||
if (wrap !== undefined) {
|
||||
return wrap.version;
|
||||
}
|
||||
wrap = yield getLatestSemVersionedTag(Object.assign(Object.assign({}, getLatestSemVersionedTagParam), { "major": undefined }));
|
||||
if (wrap !== undefined) {
|
||||
return wrap.version;
|
||||
}
|
||||
return NpmModuleVersion_1.NpmModuleVersion.parse("0.0.0");
|
||||
}))();
|
||||
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}`);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import { NpmModuleVersion } from "./tools/NpmModuleVersion";
|
|||
import { getActionParamsFactory } from "./inputHelper";
|
||||
import { createOctokit } from "./tools/createOctokit";
|
||||
import { getLatestSemVersionedTagFactory } from "./tools/octokit-addons/getLatestSemVersionedTag";
|
||||
import type { Param0 } from "tsafe";
|
||||
|
||||
|
||||
export const { getActionParams } = getActionParamsFactory({
|
||||
"inputNameSubset": [
|
||||
|
|
@ -52,13 +54,31 @@ export async function action(
|
|||
|
||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
||||
|
||||
const { version: from_version } = await getLatestSemVersionedTag({
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA"
|
||||
})
|
||||
.then(wrap => wrap === undefined ? { "version": NpmModuleVersion.parse("0.0.0") } : wrap);
|
||||
const from_version= await (async () => {
|
||||
|
||||
const getLatestSemVersionedTagParam: Param0<typeof getLatestSemVersionedTag> = {
|
||||
owner,
|
||||
repo,
|
||||
"beta": to_version.betaPreRelease !== undefined ?
|
||||
"ONLY LOOK FOR BETA" : "IGNORE BETA",
|
||||
"major": to_version.major
|
||||
};
|
||||
|
||||
let wrap = await getLatestSemVersionedTag(getLatestSemVersionedTagParam);
|
||||
|
||||
if( wrap !== undefined ){
|
||||
return wrap.version;
|
||||
}
|
||||
wrap = await getLatestSemVersionedTag({ ...getLatestSemVersionedTagParam, "major": undefined });
|
||||
|
||||
if( wrap !== undefined ){
|
||||
return wrap.version;
|
||||
}
|
||||
|
||||
return NpmModuleVersion.parse("0.0.0");
|
||||
|
||||
|
||||
})();
|
||||
|
||||
core.debug(`Last version was ${NpmModuleVersion.stringify(from_version)}`);
|
||||
|
||||
|
|
@ -69,7 +89,7 @@ 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_release_beta = is_upgraded_version === "false" ? "false" : to_version.betaPreRelease !== undefined ? "true" : "false";
|
||||
|
||||
core.debug(`Is release beta: ${is_release_beta}`);
|
||||
|
||||
|
|
@ -103,10 +123,10 @@ async function getPackageJsonVersion(params: {
|
|||
.then(res => res.text())
|
||||
.then(text => JSON.parse(text))
|
||||
.then(({ version }) => version as string)
|
||||
.catch(()=> undefined)
|
||||
.catch(() => undefined)
|
||||
;
|
||||
|
||||
if( version === undefined){
|
||||
if (version === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
|||
owner: string;
|
||||
repo: string;
|
||||
beta: "ONLY LOOK FOR BETA" | "IGNORE BETA" | "BETA OR REGULAR RELEASE";
|
||||
major: number | undefined;
|
||||
}
|
||||
): Promise<{
|
||||
tag: string;
|
||||
version: NpmModuleVersion;
|
||||
} | undefined> {
|
||||
|
||||
const { owner, repo, beta } = params;
|
||||
const { owner, repo, beta, major } = params;
|
||||
|
||||
const semVersionedTags: { tag: string; version: NpmModuleVersion; }[] = [];
|
||||
|
||||
|
|
@ -32,6 +33,10 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
|||
|
||||
version = NpmModuleVersion.parse(tag.replace(/^[vV]?/, ""));
|
||||
|
||||
if (major !== undefined && version.major !== major) {
|
||||
continue;
|
||||
}
|
||||
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export async function action(
|
|||
|
||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
||||
|
||||
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA" })) ?? {};
|
||||
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA", "major": undefined })) ?? {};
|
||||
|
||||
if( branchBehind === undefined ){
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue