diff --git a/asset_jenkins.js b/asset_jenkins.js index 3bf23c3..a4d25b7 100644 --- a/asset_jenkins.js +++ b/asset_jenkins.js @@ -25,12 +25,16 @@ child_process.execSync ('yarn lint', { stdio: 'inherit' }); child_process.execSync ('yarn test', { stdio: 'inherit' }); child_process.execSync ('yarn compile', { stdio: 'inherit' }); -child_process.exec ('git log -1 | grep \\'\\\\[no publish\\\\]\\'') - .addListener ('exit', (code) => { - if (code === 0) { - console.log ('build not marked for deployment'); - process.exit (1); - } - else { child_process.execSync ('yarn publish --access public'); } - }); +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 ( + typeof version === 'undefined' + || version[1] !== pkg.version + ) + console.log ('readme version does not match package version'); + else + child_process.execSync ('yarn publish --access public'); +} `; diff --git a/jenkins.js b/jenkins.js index c2fb836..3caa43a 100644 --- a/jenkins.js +++ b/jenkins.js @@ -16,12 +16,15 @@ child_process.execSync ('yarn lint', { stdio: 'inherit' }); child_process.execSync ('yarn test', { stdio: 'inherit' }); child_process.execSync ('yarn compile', { stdio: 'inherit' }); -child_process.exec ('git log -1 | grep \'\\[no publish\\]\'') - .addListener ('exit', (code) => { - if (code === 0) { - console.log ('build not marked for deployment'); - process.exit (1); - } - else { child_process.execSync ('yarn publish --access public'); } - }); - +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 ( + typeof version === 'undefined' + || version[1] !== pkg.version + ) + console.log ('readme version does not match package version'); + else + child_process.execSync ('yarn publish --access public'); +}