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
This commit is contained in:
Héctor Ramos
2021-09-29 00:09:53 -07:00
committed by Luna Wei
parent 6c19dc3266
commit d08397a862
4 changed files with 31 additions and 23 deletions
+1 -1
View File
@@ -896,7 +896,7 @@ workflows:
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
cron: "0 20 * * *"
filters:
branches:
only:
+7 -7
View File
@@ -56,9 +56,9 @@ Run:
git checkout -b <version_you_are_releasing>-stable
# e.g. git checkout -b 0.57-stable
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js 0.57.0-rc.0
# or ./scripts/bump-oss-version.js 0.58.0
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.0
# or ./scripts/bump-oss-version.js -v 0.58.0
```
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:
If everything worked, run the following to bump the version number:
```bash
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js 0.57.0-rc.1
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.1
```
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
If everything worked:
```bash
./scripts/bump-oss-version.js <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js 0.57.0
./scripts/bump-oss-version.js -v <exact_version_you_are_releasing>
# e.g. ./scripts/bump-oss-version.js -v 0.57.0
```
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`).
+17 -11
View File
@@ -29,17 +29,24 @@ let argv = yargs
alias: 'nightly',
type: 'boolean',
default: false,
})
.option('v', {
alias: 'to-version',
type: 'string',
}).argv;
const nightlyBuild = argv.nightly;
const version = argv.toVersion;
let version, branch;
if (nightlyBuild) {
const currentCommit = exec('git rev-parse HEAD', {
silent: true,
}).stdout.trim();
version = `0.0.0-${currentCommit.slice(0, 9)}`;
} else {
if (!version) {
echo(
'You must specify a version using -v',
);
exit(1);
}
let branch;
if (!nightlyBuild) {
// Check we are in release branch, e.g. 0.33-stable
branch = exec('git symbolic-ref --short HEAD', {
silent: true,
@@ -55,10 +62,9 @@ if (nightlyBuild) {
// - check that argument version matches branch
// e.g. 0.33.1 or 0.33.0-rc4
version = argv._[0];
if (!version || version.indexOf(versionMajor) !== 0) {
if (version.indexOf(versionMajor) !== 0) {
echo(
`You must pass a tag like 0.${versionMajor}.[X]-rc[Y] to bump a version`,
`You must specify a version tag like 0.${versionMajor}.[X]-rc[Y] to bump a version`,
);
exit(1);
}
@@ -175,7 +181,7 @@ if (!nightlyBuild) {
exit(1);
}
// Update Podfile.lock only on release builds, not nightly.
// Update Podfile.lock only on release builds, not nightlies.
// 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) {
+6 -4
View File
@@ -18,21 +18,21 @@
*
* To cut a branch (and release RC):
* - Developer: `git checkout -b 0.XY-stable`
* - Developer: `./scripts/bump-oss-version.js v0.XY.0-rc.0`
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0-rc.0`
* - CI: test and deploy to npm (run this script) with version `0.XY.0-rc.0`
* with tag "next"
*
* To update RC release:
* - Developer: `git checkout 0.XY-stable`
* - Developer: cherry-pick whatever changes needed
* - Developer: `./scripts/bump-oss-version.js v0.XY.0-rc.1`
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0-rc.1`
* - CI: test and deploy to npm (run this script) with version `0.XY.0-rc.1`
* with tag "next"
*
* To publish a release:
* - Developer: `git checkout 0.XY-stable`
* - Developer: cherry-pick whatever changes needed
* - Developer: `./scripts/bump-oss-version.js v0.XY.0`
* - Developer: `./scripts/bump-oss-version.js -v v0.XY.0`
* - CI: test and deploy to npm (run this script) with version `0.XY.0`
* and no tag ("latest" is implied by npm)
*
@@ -111,7 +111,9 @@ if (nightlyBuild) {
// Bump version number in various files (package.json, gradle.properties etc)
if (
exec(`node scripts/bump-oss-version.js --nightly ${releaseVersion}`).code
exec(
`node scripts/bump-oss-version.js --nightly --to-version ${releaseVersion}`,
).code
) {
echo('Failed to bump version number');
exit(1);