Skip to content

Commit a6a983d

Browse files
committed
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
1 parent ef280d6 commit a6a983d

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

Diff for: scripts/bump-oss-version.js

+17-14
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ let argv = yargs
3232
}).argv;
3333

3434
const nightlyBuild = argv.nightly;
35-
// Nightly builds don't need an update as main will already be up-to-date.
36-
const updatePodfileLock = !nightlyBuild;
3735

3836
let version, branch;
3937
if (nightlyBuild) {
@@ -154,33 +152,38 @@ if (
154152
// Change react-native version in the template's package.json
155153
exec(`node scripts/set-rn-template-version.js ${version}`);
156154

157-
if (updatePodfileLock) {
158-
echo('Updating RNTester Podfile.lock...')
159-
if (exec('source scripts/update_podfile_lock.sh && update_pods').code) {
160-
echo('Failed to update RNTester Podfile.lock.');
161-
echo('Fix the issue, revert and try again.');
162-
exit(1);
163-
}
164-
}
165-
166155
// Verify that files changed, we just do a git diff and check how many times version is added across files
156+
const filesToValidate = [
157+
'package.json',
158+
'ReactAndroid/gradle.properties',
159+
'template/package.json',
160+
];
167161
let numberOfChangedLinesWithNewVersion = exec(
168-
`git diff -U0 | grep '^[+]' | grep -c ${version} `,
162+
`git diff -U0 ${filesToValidate.join(' ')}| grep '^[+]' | grep -c ${version} `,
169163
{silent: true},
170164
).stdout.trim();
171165

172166
// Release builds should commit the version bumps, and create tags.
173167
// Nightly builds do not need to do that.
174168
if (!nightlyBuild) {
175-
if (+numberOfChangedLinesWithNewVersion !== 3) {
169+
if (+numberOfChangedLinesWithNewVersion !== filesToValidate.length) {
176170
echo(
177-
'Failed to update all the files. package.json and gradle.properties must have versions in them',
171+
`Failed to update all the files: [${filesToValidate.join(', ')}] must have versions in them`,
178172
);
179173
echo('Fix the issue, revert and try again');
180174
exec('git diff');
181175
exit(1);
182176
}
183177

178+
// Update Podfile.lock only on release builds, not nightly.
179+
// Nightly builds don't need it as the main branch will already be up-to-date.
180+
echo('Updating RNTester Podfile.lock...');
181+
if (exec('source scripts/update_podfile_lock.sh && update_pods').code) {
182+
echo('Failed to update RNTester Podfile.lock.');
183+
echo('Fix the issue, revert and try again.');
184+
exit(1);
185+
}
186+
184187
// Make commit [0.21.0-rc] Bump version numbers
185188
if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) {
186189
echo('failed to commit');

0 commit comments

Comments
 (0)