diff --git a/scripts/bump-oss-version.js b/scripts/bump-oss-version.js index e565236fa09..055daf4777b 100755 --- a/scripts/bump-oss-version.js +++ b/scripts/bump-oss-version.js @@ -32,8 +32,6 @@ let argv = yargs }).argv; const nightlyBuild = argv.nightly; -// Nightly builds don't need an update as main will already be up-to-date. -const updatePodfileLock = !nightlyBuild; let version, branch; if (nightlyBuild) { @@ -154,33 +152,38 @@ if ( // Change react-native version in the template's package.json exec(`node scripts/set-rn-template-version.js ${version}`); -if (updatePodfileLock) { - echo('Updating RNTester Podfile.lock...') - if (exec('source scripts/update_podfile_lock.sh && update_pods').code) { - echo('Failed to update RNTester Podfile.lock.'); - echo('Fix the issue, revert and try again.'); - exit(1); - } -} - // Verify that files changed, we just do a git diff and check how many times version is added across files +const filesToValidate = [ + 'package.json', + 'ReactAndroid/gradle.properties', + 'template/package.json', +]; let numberOfChangedLinesWithNewVersion = exec( - `git diff -U0 | grep '^[+]' | grep -c ${version} `, + `git diff -U0 ${filesToValidate.join(' ')}| grep '^[+]' | grep -c ${version} `, {silent: true}, ).stdout.trim(); // Release builds should commit the version bumps, and create tags. // Nightly builds do not need to do that. if (!nightlyBuild) { - if (+numberOfChangedLinesWithNewVersion !== 3) { + if (+numberOfChangedLinesWithNewVersion !== filesToValidate.length) { echo( - 'Failed to update all the files. package.json and gradle.properties must have versions in them', + `Failed to update all the files: [${filesToValidate.join(', ')}] must have versions in them`, ); echo('Fix the issue, revert and try again'); exec('git diff'); exit(1); } + // Update Podfile.lock only on release builds, not nightly. + // Nightly builds don't need it as the main branch will already be up-to-date. + echo('Updating RNTester Podfile.lock...'); + if (exec('source scripts/update_podfile_lock.sh && update_pods').code) { + echo('Failed to update RNTester Podfile.lock.'); + echo('Fix the issue, revert and try again.'); + exit(1); + } + // Make commit [0.21.0-rc] Bump version numbers if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) { echo('failed to commit');