Skip to content

Commit b29b05f

Browse files
hramosfacebook-github-bot
authored andcommitted
bump-oss-version: Add -v / --to-version argument and use it when bumping nightly releases (now at 20:00 UTC)
Summary: Add a new -v or --to-version argument to the bump-oss-version script. When the bump-oss-version script runs, it will use the version string that is passed in, instead of trying to infer it from the current commit. This fixes a bug in the last nightly release where the bump script used a different version string than what the publish script expected. Nightlies now run at 20:00 hours UTC. Changelog: [Internal] Reviewed By: fkgozali, TheSavior Differential Revision: D31261829 fbshipit-source-id: a9341f93c3c7bf0379aa3c5e7f345182df70f846
1 parent c6907ee commit b29b05f

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ workflows:
883883
nightly:
884884
triggers:
885885
- schedule:
886-
cron: "0 0 * * *"
886+
cron: "0 20 * * *"
887887
filters:
888888
branches:
889889
only:

Diff for: Releases.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ Run:
5656
git checkout -b <version_you_are_releasing>-stable
5757
# e.g. git checkout -b 0.57-stable
5858

59-
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
60-
# e.g. ./scripts/bump-oss-version.js 0.57.0-rc.0
61-
# or ./scripts/bump-oss-version.js 0.58.0
59+
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
60+
# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.0
61+
# or ./scripts/bump-oss-version.js -v 0.58.0
6262
```
6363

6464
Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0-rc.0`) and tag `next` meaning that this version will not be installed for users by default.
@@ -147,8 +147,8 @@ Go through the same process as earlier to test the release:
147147
If everything worked, run the following to bump the version number:
148148

149149
```bash
150-
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
151-
# e.g. ./scripts/bump-oss-version.js 0.57.0-rc.1
150+
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
151+
# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.1
152152
```
153153

154154
Again, Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0-rc.1`).
@@ -191,8 +191,8 @@ It's **important** to test everything again: you don't want to cut a release wit
191191
If everything worked:
192192

193193
```bash
194-
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
195-
# e.g. ./scripts/bump-oss-version.js 0.57.0
194+
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
195+
# e.g. ./scripts/bump-oss-version.js -v 0.57.0
196196
```
197197

198198
As with the release candidate, Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0`).

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

+17-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,24 @@ let argv = yargs
2929
alias: 'nightly',
3030
type: 'boolean',
3131
default: false,
32+
})
33+
.option('v', {
34+
alias: 'to-version',
35+
type: 'string',
3236
}).argv;
3337

3438
const nightlyBuild = argv.nightly;
39+
const version = argv.toVersion;
3540

36-
let version, branch;
37-
if (nightlyBuild) {
38-
const currentCommit = exec('git rev-parse HEAD', {
39-
silent: true,
40-
}).stdout.trim();
41-
version = `0.0.0-${currentCommit.slice(0, 9)}`;
42-
} else {
41+
if (!version) {
42+
echo(
43+
'You must specify a version using -v',
44+
);
45+
exit(1);
46+
}
47+
48+
let branch;
49+
if (!nightlyBuild) {
4350
// Check we are in release branch, e.g. 0.33-stable
4451
branch = exec('git symbolic-ref --short HEAD', {
4552
silent: true,
@@ -55,10 +62,9 @@ if (nightlyBuild) {
5562

5663
// - check that argument version matches branch
5764
// e.g. 0.33.1 or 0.33.0-rc4
58-
version = argv._[0];
59-
if (!version || version.indexOf(versionMajor) !== 0) {
65+
if (version.indexOf(versionMajor) !== 0) {
6066
echo(
61-
`You must pass a tag like 0.${versionMajor}.[X]-rc[Y] to bump a version`,
67+
`You must specify a version tag like 0.${versionMajor}.[X]-rc[Y] to bump a version`,
6268
);
6369
exit(1);
6470
}
@@ -178,7 +184,7 @@ if (!nightlyBuild) {
178184
exit(1);
179185
}
180186

181-
// Update Podfile.lock only on release builds, not nightly.
187+
// Update Podfile.lock only on release builds, not nightlies.
182188
// Nightly builds don't need it as the main branch will already be up-to-date.
183189
echo('Updating RNTester Podfile.lock...');
184190
if (exec('source scripts/update_podfile_lock.sh && update_pods').code) {

Diff for: scripts/publish-npm.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
*
1919
* To cut a branch (and release RC):
2020
* - Developer: `git checkout -b 0.XY-stable`
21-
* - Developer: `./scripts/bump-oss-version.js v0.XY.0-rc.0`
21+
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0-rc.0`
2222
* - CI: test and deploy to npm (run this script) with version `0.XY.0-rc.0`
2323
* with tag "next"
2424
*
2525
* To update RC release:
2626
* - Developer: `git checkout 0.XY-stable`
2727
* - Developer: cherry-pick whatever changes needed
28-
* - Developer: `./scripts/bump-oss-version.js v0.XY.0-rc.1`
28+
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0-rc.1`
2929
* - CI: test and deploy to npm (run this script) with version `0.XY.0-rc.1`
3030
* with tag "next"
3131
*
3232
* To publish a release:
3333
* - Developer: `git checkout 0.XY-stable`
3434
* - Developer: cherry-pick whatever changes needed
35-
* - Developer: `./scripts/bump-oss-version.js v0.XY.0`
35+
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0`
3636
* - CI: test and deploy to npm (run this script) with version `0.XY.0`
3737
* and no tag ("latest" is implied by npm)
3838
*
@@ -128,7 +128,9 @@ if (buildFromMain) {
128128
}
129129
// Bump version number in various files (package.json, gradle.properties etc)
130130
if (
131-
exec(`node scripts/bump-oss-version.js --nightly ${releaseVersion}`).code
131+
exec(
132+
`node scripts/bump-oss-version.js --nightly --to-version ${releaseVersion}`,
133+
).code
132134
) {
133135
echo('Failed to bump version number');
134136
exit(1);

0 commit comments

Comments
 (0)