mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
OSS: bump-oss-version -- update Podfile.lock later in the flow
Summary: There was some hardcoded validation logic to verify package.json and gradle.properties update. Running `pod install` before that failed this validation on release branch, so let's move the pod update a bit later in the flow. This also restrict the version number change check to the specific files for better reliability Changelog: [Internal] Reviewed By: sota000 Differential Revision: D31160139 fbshipit-source-id: d32470d7dfc48c2efab1d2767f3892b33e0b77dd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d3c7e20183
commit
ec9e97179e
+17
-14
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user