test if version upgraded: Beta release independent from regular release

This commit is contained in:
garronej 2022-08-02 14:19:50 +02:00
parent 66b83c9642
commit 6a267b716c
4 changed files with 52 additions and 21 deletions

25
dist/index.js vendored
View file

@ -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, doIgnoreBeta } = params;
const { owner, repo, beta } = params;
const semVersionedTags = [];
const { listTags } = listTags_1.listTagsFactory({ octokit });
try {
@ -7912,8 +7912,18 @@ function getLatestSemVersionedTagFactory(params) {
catch (_d) {
continue;
}
if (doIgnoreBeta && version.betaPreRelease !== undefined) {
continue;
switch (beta) {
case "IGNORE BETA":
if (version.betaPreRelease !== undefined) {
continue;
}
break;
case "ONLY LOOK FOR BETA":
if (version.betaPreRelease === undefined) {
continue;
}
case "BETA OR REGULAR RELEASE":
break;
}
semVersionedTags.push({ tag, version });
}
@ -9180,7 +9190,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, "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) {
core.warning(`It's the first release, not editing the CHANGELOG.md`);
return;
@ -12403,7 +12413,12 @@ 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, "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);
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";