mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
test if version upgraded: Beta release independent from regular release
This commit is contained in:
parent
66b83c9642
commit
6a267b716c
4 changed files with 52 additions and 21 deletions
23
dist/index.js
vendored
23
dist/index.js
vendored
|
|
@ -7899,7 +7899,7 @@ function getLatestSemVersionedTagFactory(params) {
|
||||||
function getLatestSemVersionedTag(params) {
|
function getLatestSemVersionedTag(params) {
|
||||||
var e_1, _a;
|
var e_1, _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { owner, repo, doIgnoreBeta } = params;
|
const { owner, repo, beta } = params;
|
||||||
const semVersionedTags = [];
|
const semVersionedTags = [];
|
||||||
const { listTags } = listTags_1.listTagsFactory({ octokit });
|
const { listTags } = listTags_1.listTagsFactory({ octokit });
|
||||||
try {
|
try {
|
||||||
|
|
@ -7912,9 +7912,19 @@ function getLatestSemVersionedTagFactory(params) {
|
||||||
catch (_d) {
|
catch (_d) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (doIgnoreBeta && version.betaPreRelease !== undefined) {
|
switch (beta) {
|
||||||
|
case "IGNORE BETA":
|
||||||
|
if (version.betaPreRelease !== undefined) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "ONLY LOOK FOR BETA":
|
||||||
|
if (version.betaPreRelease === undefined) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case "BETA OR REGULAR RELEASE":
|
||||||
|
break;
|
||||||
|
}
|
||||||
semVersionedTags.push({ tag, version });
|
semVersionedTags.push({ tag, version });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9180,7 +9190,7 @@ function action(_actionName, params, core) {
|
||||||
const octokit = createOctokit_1.createOctokit({ github_token });
|
const octokit = createOctokit_1.createOctokit({ github_token });
|
||||||
const { getCommitAhead } = getCommitAhead_1.getCommitAheadFactory({ octokit });
|
const { getCommitAhead } = getCommitAhead_1.getCommitAheadFactory({ octokit });
|
||||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
||||||
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "doIgnoreBeta": true }))) !== null && _a !== void 0 ? _a : {};
|
const { tag: branchBehind } = (_a = (yield getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA" }))) !== null && _a !== void 0 ? _a : {};
|
||||||
if (branchBehind === undefined) {
|
if (branchBehind === undefined) {
|
||||||
core.warning(`It's the first release, not editing the CHANGELOG.md`);
|
core.warning(`It's the first release, not editing the CHANGELOG.md`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -12403,7 +12413,12 @@ function action(_actionName, params, core) {
|
||||||
core.debug(`Version on ${owner}/${repo}#${branch} is ${NpmModuleVersion_1.NpmModuleVersion.stringify(to_version)}`);
|
core.debug(`Version on ${owner}/${repo}#${branch} is ${NpmModuleVersion_1.NpmModuleVersion.stringify(to_version)}`);
|
||||||
const octokit = createOctokit_1.createOctokit({ github_token });
|
const octokit = createOctokit_1.createOctokit({ github_token });
|
||||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
const { getLatestSemVersionedTag } = getLatestSemVersionedTag_1.getLatestSemVersionedTagFactory({ octokit });
|
||||||
const { version: from_version } = yield getLatestSemVersionedTag({ owner, repo, "doIgnoreBeta": false })
|
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);
|
.then(wrap => wrap === undefined ? { "version": NpmModuleVersion_1.NpmModuleVersion.parse("0.0.0") } : wrap);
|
||||||
core.debug(`Last version was ${NpmModuleVersion_1.NpmModuleVersion.stringify(from_version)}`);
|
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";
|
const is_upgraded_version = NpmModuleVersion_1.NpmModuleVersion.compare(to_version, from_version) === 1 ? "true" : "false";
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,19 @@ export async function action(
|
||||||
throw new Error(`No version in package.json on ${owner}/${repo}#${branch} (or repo is private)`);
|
throw new Error(`No version in package.json on ${owner}/${repo}#${branch} (or repo is private)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
core.debug(`Version on ${owner}/${repo}#${branch} is ${NpmModuleVersion.stringify(to_version)}`);
|
core.debug(`Version on ${owner}/${repo}#${branch} is ${NpmModuleVersion.stringify(to_version)}`);
|
||||||
|
|
||||||
const octokit = createOctokit({ github_token });
|
const octokit = createOctokit({ github_token });
|
||||||
|
|
||||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
||||||
|
|
||||||
const { version: from_version } = await getLatestSemVersionedTag({ owner, repo, "doIgnoreBeta": false })
|
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);
|
.then(wrap => wrap === undefined ? { "version": NpmModuleVersion.parse("0.0.0") } : wrap);
|
||||||
|
|
||||||
core.debug(`Last version was ${NpmModuleVersion.stringify(from_version)}`);
|
core.debug(`Last version was ${NpmModuleVersion.stringify(from_version)}`);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import { listTagsFactory } from "./listTags";
|
import { listTagsFactory } from "./listTags";
|
||||||
import type { Octokit } from "@octokit/rest";
|
import type { Octokit } from "@octokit/rest";
|
||||||
import { NpmModuleVersion } from "../NpmModuleVersion";
|
import { NpmModuleVersion } from "../NpmModuleVersion";
|
||||||
|
|
||||||
export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
||||||
|
|
||||||
|
|
@ -11,14 +11,14 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
||||||
params: {
|
params: {
|
||||||
owner: string;
|
owner: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
doIgnoreBeta: boolean;
|
beta: "ONLY LOOK FOR BETA" | "IGNORE BETA" | "BETA OR REGULAR RELEASE";
|
||||||
}
|
}
|
||||||
): Promise<{
|
): Promise<{
|
||||||
tag: string;
|
tag: string;
|
||||||
version: NpmModuleVersion;
|
version: NpmModuleVersion;
|
||||||
} | undefined> {
|
} | undefined> {
|
||||||
|
|
||||||
const { owner, repo, doIgnoreBeta } = params;
|
const { owner, repo, beta } = params;
|
||||||
|
|
||||||
const semVersionedTags: { tag: string; version: NpmModuleVersion; }[] = [];
|
const semVersionedTags: { tag: string; version: NpmModuleVersion; }[] = [];
|
||||||
|
|
||||||
|
|
@ -28,17 +28,27 @@ export function getLatestSemVersionedTagFactory(params: { octokit: Octokit; }) {
|
||||||
|
|
||||||
let version: NpmModuleVersion;
|
let version: NpmModuleVersion;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
|
|
||||||
version = NpmModuleVersion.parse(tag.replace(/^[vV]?/, ""));
|
version = NpmModuleVersion.parse(tag.replace(/^[vV]?/, ""));
|
||||||
|
|
||||||
}catch{
|
} catch {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( doIgnoreBeta && version.betaPreRelease !== undefined ){
|
switch (beta) {
|
||||||
|
case "IGNORE BETA":
|
||||||
|
if (version.betaPreRelease !== undefined) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "ONLY LOOK FOR BETA":
|
||||||
|
if (version.betaPreRelease === undefined) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case "BETA OR REGULAR RELEASE":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
semVersionedTags.push({ tag, version });
|
semVersionedTags.push({ tag, version });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export async function action(
|
||||||
|
|
||||||
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
const { getLatestSemVersionedTag } = getLatestSemVersionedTagFactory({ octokit });
|
||||||
|
|
||||||
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "doIgnoreBeta": true })) ?? {};
|
const { tag: branchBehind } = (await getLatestSemVersionedTag({ owner, repo, "beta": "IGNORE BETA" })) ?? {};
|
||||||
|
|
||||||
if( branchBehind === undefined ){
|
if( branchBehind === undefined ){
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue