Skip to content

Commit

Permalink
chore(ci): fix release find last tag (#17226)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Jan 9, 2025
1 parent 698d9c3 commit a9e578b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/scripts/bump_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,28 @@ module.exports = async ({ github, context, core }) => {
let releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1,
per_page: 10,
});
let tag = releases.data[0].tag_name;
let result = /v(\d+)\.(\d+)\.(\d+)/g.exec(tag);
let lastTag = releases.data.filter(
(r) => r.tag_name.startsWith("v") && r.tag_name.endsWith("-nightly")
)[0];
if (!lastTag) {
core.setFailed(`No previous nightly release found, ignoring`);
return;
}
let result = /v(\d+)\.(\d+)\.(\d+)/g.exec(lastTag.tag_name);
if (result === null) {
core.setFailed(`The previous tag ${tag} is invalid, ignoring`);
core.setFailed(
`The previous tag ${lastTag.tag_name} is invalid, ignoring`
);
return;
}
let major = result[1];
let minor = result[2];
let patch = (parseInt(result[3]) + 1).toString();
let next_tag = `v${major}.${minor}.${patch}-nightly`;
core.setOutput("tag", next_tag);
core.info(`Nightly release ${next_tag} from ${tag} (${context.sha})`);
let nextTag = `v${major}.${minor}.${patch}-nightly`;
core.setOutput("tag", nextTag);
core.info(`Nightly release ${nextTag} from ${lastTag} (${context.sha})`);
}
}
};

0 comments on commit a9e578b

Please sign in to comment.