only trigger on major and minor version

This commit is contained in:
Timo Hocker 2020-05-13 13:23:47 +02:00
parent 439c192bfb
commit 0b484db04d
2 changed files with 10 additions and 2 deletions

View File

@ -35,13 +35,17 @@ if (typeof pkg.repository === 'undefined') {
process.exit (1);
}
function major (version) {
return version.replace (/\\.[0-9]+$/ui, '');
}
if (fs.existsSync ('README.md')) {
const readme = fs.readFileSync ('README.md', 'utf-8');
// eslint-disable-next-line prefer-named-capture-group
const version = (/version: ([0-9.]+)/ui).exec (readme);
if (
version === null
|| version[1] !== pkg.version
|| major (version[1]) !== major (pkg.version)
) {
console.log ('readme version does not match package version');
process.exit (1);

View File

@ -26,13 +26,17 @@ if (typeof pkg.repository === 'undefined') {
process.exit (1);
}
function major (version) {
return version.replace (/\.[0-9]+$/ui, '');
}
if (fs.existsSync ('README.md')) {
const readme = fs.readFileSync ('README.md', 'utf-8');
// eslint-disable-next-line prefer-named-capture-group
const version = (/version: ([0-9.]+)/ui).exec (readme);
if (
version === null
|| version[1] !== pkg.version
|| major (version[1]) !== major (pkg.version)
) {
console.log ('readme version does not match package version');
process.exit (1);