Skip to content

Commit

Permalink
doc: update version pattern <cli version>-<year>.<month>
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Oct 23, 2024
1 parent 45a4203 commit 3c72bf6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/bin/nextversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getNextVersion (previousVersion) {
// get previous version number
// NOTE:
// only versions of the form N.x are accepted
const previousVersionMatch = previousVersion.match(/^(\d+)\.x$/);
const previousVersionMatch = previousVersion.match(/^(\d+)\.x(-\d{4}.\d{2})?$/);
if (!previousVersionMatch) {
throw Error('invalid version');
}
Expand All @@ -31,7 +31,10 @@ function getNextVersion (previousVersion) {
const nextMajor = parseInt(previousMajor) + 1;

// create next version
const nextVersion = nextMajor + '.x';
const currentDate = new Date();
const currentYear = currentDate.getFullYear();
const currentMonth = (currentDate.getMonth() + 1).toString().padStart(2, '0');
const nextVersion = `${nextMajor}.x-${currentYear}.${currentMonth}`;

return nextVersion;
}
Expand Down

0 comments on commit 3c72bf6

Please sign in to comment.