Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b55f38e
Download Circle CI artifact and prepare canary release
Nov 13, 2018
0240640
New create-canary script
Nov 15, 2018
c197be7
New prepare-canary release script
Nov 16, 2018
71c1046
Added release script README
Nov 16, 2018
341ebb3
Shuffled around and tidied up
Nov 16, 2018
bbb9d9e
Added publish command and slightly refactored some other command mess…
Nov 17, 2018
4d53087
Always log NPM commands (even if not dry run)
Nov 17, 2018
86d3036
Fixed resume check typo/bug
Nov 17, 2018
43ac899
Added check for build-info.json in files array
Nov 18, 2018
1018c30
Replaced chalk usage with shared theme for consistancy
Nov 18, 2018
baecb2e
Updated release script README
Nov 19, 2018
26a00aa
Store error codes JSON as a build artifact also
Nov 19, 2018
b3d1a81
Store Circle CI build number in build-info.json
Nov 19, 2018
e624d14
Revert (intentional) temporary error message change
Nov 19, 2018
3585929
Download error-codes from Circle CI after publishing
Nov 19, 2018
0bbdbdd
Add release script snapshot test
Nov 20, 2018
40dde41
Update package JSONs automatically after stable release is publish
Nov 20, 2018
03abe2a
Fixed a typo
Nov 23, 2018
8747fa6
Updated fixtures/packaging tests to use build/node_modules rather tha…
Nov 23, 2018
83745a7
Added note about --dry flag for publish script to README
Nov 23, 2018
02774ef
Added {cwd} options to NPM pack-and-unpack commends
Nov 23, 2018
d30f652
Fixed another relative path issue for prepare-canary script
Nov 23, 2018
38c8aca
Nit about pushstate-server usage
Nov 23, 2018
82d170a
Merge branch 'automated-release-scripts-part-4' into automated-releas…
Nov 23, 2018
694b6a9
Merge branch 'master' into automated-release-scripts-part-5
Nov 23, 2018
fce3353
Test script also supports running from non-root directory now
Nov 23, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ jobs:
- node_modules

- store_artifacts:
path: ./node_modules.tgz
path: ./node_modules.tgz

- store_artifacts:
path: ./scripts/error-codes/codes.json
2 changes: 1 addition & 1 deletion fixtures/attribute-behavior/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"scripts": {
"prestart":
"cp ../../build/dist/react.development.js public/ && cp ../../build/dist/react-dom.development.js public/ && cp ../../build/dist/react-dom-server.browser.development.js public/",
"cp ../../build/node_modules/react/umd/react.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom-server.browser.development.js public/",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
Expand Down
2 changes: 1 addition & 1 deletion fixtures/dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"start": "react-scripts start",
"prestart": "cp ../../build/dist/react.development.js ../../build/dist/react-dom.development.js ../../build/dist/react.production.min.js ../../build/dist/react-dom.production.min.js ../../build/dist/react-dom-server.browser.development.js ../../build/dist/react-dom-server.browser.production.min.js public/",
"prestart": "cp ../../build/node_modules/react/umd/react.development.js ../../build/node_modules/react-dom/umd/react-dom.development.js ../../build/node_modules/react/umd/react.production.min.js ../../build/node_modules/react-dom/umd/react-dom.production.min.js ../../build/node_modules/react-dom/umd/react-dom-server.browser.development.js ../../build/node_modules/react-dom/umd/react-dom-server.browser.production.min.js public/",
"build": "react-scripts build && cp build/index.html build/200.html",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
Expand Down
2 changes: 1 addition & 1 deletion fixtures/expiration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"prestart":
"cp ../../build/dist/react.development.js public/ && cp ../../build/dist/react-dom.development.js public/",
"cp ../../build/node_modules/react/umd/react.development.js public/ && cp ../../build/node_modules/react-dom/umd/react-dom.development.js public/",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
Expand Down
4 changes: 2 additions & 2 deletions fixtures/fiber-triangle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ <h1>Fiber Example</h1>
If you checked out the source from GitHub make sure to run <code>npm run build</code>.
</p>
</div>
<script src="../../build/dist/react.development.js"></script>
<script src="../../build/dist/react-dom.development.js"></script>
<script src="../../build/node_modules/react/umd/react.development.js"></script>
<script src="../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
<script type="text/babel">
var dotStyle = {
Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/babel-standalone/dev.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>
<script src="../../../build/dist/react.development.js"></script>
<script src="../../../build/dist/react-dom.development.js"></script>
<script src="../../../build/node_modules/react/umd/react.development.js"></script>
<script src="../../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
<div id="container"></div>
<script type="text/babel">
Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/globals/dev.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>
<script src="../../../build/dist/react.development.js"></script>
<script src="../../../build/dist/react-dom.development.js"></script>
<script src="../../../build/node_modules/react/umd/react.development.js"></script>
<script src="../../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
<div id="container"></div>
<script>
ReactDOM.render(
Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/globals/prod.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>
<script src="../../../build/dist/react.production.min.js"></script>
<script src="../../../build/dist/react-dom.production.min.js"></script>
<script src="../../../build/node_modules/react/umd/react.production.min.js"></script>
<script src="../../../build/node_modules/react-dom/umd/react-dom.production.min.js"></script>
<div id="container"></div>
<script>
ReactDOM.render(
Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/requirejs/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<script>
requirejs.config({
paths: {
react: '../../../build/dist/react.development',
'react-dom': '../../../build/dist/react-dom.development'
react: '../../../build/node_modules/react/umd/react.development',
'react-dom': '../../../build/node_modules/react-dom/umd/react-dom.development'
}
});

Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/requirejs/prod.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<script>
requirejs.config({
paths: {
react: '../../../build/dist/react.production.min',
'react-dom': '../../../build/dist/react-dom.production.min'
react: '../../../build/node_modules/react/umd/react.production.min',
'react-dom': '../../../build/node_modules/react-dom/umd/react-dom.production.min'
}
});

Expand Down
5 changes: 3 additions & 2 deletions fixtures/packaging/rjs/dev/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ module.exports = {
out: 'output.js',
optimize: 'none',
paths: {
react: '../../../../build/dist/react.development',
'react-dom': '../../../../build/dist/react-dom.development',
react: '../../../../build/node_modules/react/umd/react.development',
'react-dom':
'../../../../build/node_modules/react-dom/umd/react-dom.development',
schedule: '../../../../build/dist/schedule.development',
},
};
5 changes: 3 additions & 2 deletions fixtures/packaging/rjs/prod/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ module.exports = {
out: 'output.js',
optimize: 'none',
paths: {
react: '../../../../build/dist/react.production.min',
'react-dom': '../../../../build/dist/react-dom.production.min',
react: '../../../../build/node_modules/react/umd/react.production.min',
'react-dom':
'../../../../build/node_modules/react-dom/umd/react-dom.production.min',
schedule: '../../../../build/dist/schedule.development',
},
};
5 changes: 3 additions & 2 deletions fixtures/packaging/systemjs-builder/dev/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
System.config({
paths: {
react: '../../../../build/dist/react.development.js',
'react-dom': '../../../../build/dist/react-dom.development.js',
react: '../../../../build/node_modules/react/umd/react.development.js',
'react-dom':
'../../../../build/node_modules/react-dom/umd/react-dom.development.js',
schedule: '../../../../build/dist/schedule.development',
},
});
5 changes: 3 additions & 2 deletions fixtures/packaging/systemjs-builder/prod/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
System.config({
paths: {
react: '../../../../build/dist/react.production.min.js',
'react-dom': '../../../../build/dist/react-dom.production.min.js',
react: '../../../../build/node_modules/react/umd/react.production.min.js',
'react-dom':
'../../../../build/node_modules/react-dom/umd/react-dom.production.min.js',
schedule: '../../../../build/dist/schedule.development',
},
});
4 changes: 2 additions & 2 deletions fixtures/packaging/systemjs/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<script>
System.config({
paths: {
react: '../../../build/dist/react.development.js',
'react-dom': '../../../build/dist/react-dom.development.js'
react: '../../../build/node_modules/react/umd/react.development.js',
'react-dom': '../../../build/node_modules/react-dom/umd/react-dom.development.js'
}
});

Expand Down
4 changes: 2 additions & 2 deletions fixtures/packaging/systemjs/prod.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<script>
System.config({
paths: {
react: '../../../build/dist/react.production.min.js',
'react-dom': '../../../build/dist/react-dom.production.min.js'
react: '../../../build/node_modules/react/umd/react.production.min.js',
'react-dom': '../../../build/node_modules/react-dom/umd/react-dom.production.min.js'
}
});

Expand Down
2 changes: 1 addition & 1 deletion fixtures/scheduler/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h2>Tests:</h2>
<div> If the counter advanced while you were away from this tab, it's correct.</div>
</li>
</ol>
<script src="../../build/dist/react.development.js"></script>
<script src="../../build/node_modules/react/umd/react.development.js"></script>
<script src="../../build/node_modules/scheduler/umd/scheduler.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
<script type="text/babel">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
},
"scripts": {
"build": "npm run version-check && node ./scripts/rollup/build.js",
"build": "node ./scripts/rollup/build.js",
"linc": "node ./scripts/tasks/linc.js",
"lint": "node ./scripts/tasks/eslint.js",
"lint-build": "node ./scripts/rollup/validate/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/create-subscription/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs"
],
Expand Down
1 change: 1 addition & 0 deletions packages/jest-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
]
Expand Down
1 change: 1 addition & 0 deletions packages/react-art/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/",
Expand Down
1 change: 1 addition & 0 deletions packages/react-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-debug-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
],
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"profiling.js",
"server.js",
Expand Down
1 change: 1 addition & 0 deletions packages/react-is/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-noop-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"persistent.js",
"cjs/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-reconciler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"persistent.js",
"reflection.js",
Expand Down
1 change: 1 addition & 0 deletions packages/react-test-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"shallow.js",
"cjs/",
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/scheduler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"tracing.js",
"tracing-profiling.js",
Expand Down
5 changes: 5 additions & 0 deletions scripts/circleci/add_build_info_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

node ./scripts/release/ci-add-build-info-json.js
2 changes: 2 additions & 0 deletions scripts/circleci/test_entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
fi

if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./scripts/circleci/add_build_info_json.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/update_package_versions.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/build.sh')
COMMANDS_TO_RUN+=('yarn test-build --maxWorkers=2')
COMMANDS_TO_RUN+=('yarn test-build-prod --maxWorkers=2')
Expand Down
5 changes: 5 additions & 0 deletions scripts/circleci/update_package_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

node ./scripts/release/ci-update-package-versions.js
67 changes: 60 additions & 7 deletions scripts/release/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,66 @@
# React Release Scripts

At a high-level, the release process uses two scripts: **build** and **publish**.
1. The **build** script does the heavy lifting (e.g., checking CI, running automated tests, building Rollup bundles) and then prints instructions for manual verification.
1. The **publish** script then publishes the built artifacts to npm and pushes to GitHub.
The release process consists of several phases, each one represented by one of the scripts below.

Run either script without parameters to see its usage, e.g.:
A typical release goes like this:
1. When a commit is pushed to the React repo, [Circle CI](https://circleci.com/gh/facebook/react/) will build all release bundles and run unit tests against both the source code and the built bundles.
2. Next the release is published as a canary using the [`prepare-canary`](#prepare-canary) and [`publish`](#publish) scripts. (Currently this process is manual but might be automated in the future using [GitHub "actions"](https://github.com/features/actions).)
3. Finally, a canary releases can be promoted to stable using the [`prepare-stable`](#prepare-stable) and [`publish`](#publish) scripts. (This process is always manual.)

One or more release scripts are used for each of the above phases. Learn more about these scripts below:
* [`create-canary`](#create-canary)
* [`prepare-canary`](#prepare-canary)
* [`prepare-stable`](#prepare-stable)
* [`publish`](#publish)

## `create-canary`
Creates a canary build from the current (local) Git revision.

**This script is an escape hatch.** It allows a canary release to be created without pushing a commit to be verified by Circle CI. **It does not run any automated unit tests.** Testing is solely the responsibility of the release engineer.

Note that this script git-archives the React repo (at the current revision) to a temporary directory before building, so **uncommitted changes are not included in the build**.

#### Example usage
To create a canary from the current branch and revision:
```sh
scripts/release/create-canary.js
```
./scripts/release/build.js
./scripts/release/publish.js

## `prepare-canary`
Downloads build artifacts from Circle CI in preparation to be published to NPM as a canary release.

All artifacts built by Circle CI have already been unit-tested (both source and bundles) but canaries should **always be manually tested** before being published. Upon completion, this script prints manual testing instructions.

#### Example usage
To prepare the artifacts created by [Circle CI build 12677](https://circleci.com/gh/facebook/react/12677#artifacts/containers/0) you would run:
```sh
scripts/release/prepare-canary.js --build=12677
```

Each script will guide the release engineer through any necessary steps (including environment setup and manual testing steps).
## `prepare-stable`
Checks out a canary release from NPM and prepares it to be published as a stable release.

This script prompts for new (stable) release versions for each public package and updates the package contents (both `package.json` and inline version numbers) to match. It also updates inter-package dependencies to account for the new versions.

Canary release have already been tested but it is still a good idea to **manually test and verify a release** before publishing to ensure that e.g. version numbers are correct. Upon completion, this script prints manual testing instructions.

#### Example usage
To promote the canary release `0.0.0-5bf84d292` (aka commit [5bf84d292](https://github.com/facebook/react/commit/5bf84d292)) to stable:
```sh
scripts/release/prepare-stable.js --version=0.0.0-5bf84d292
```

## `publish`
Publishes the current contents of `build/node_modules` to NPM.

This script publishes each public package to NPM and updates the specified tag(s) to match. **It does not test or verify the local package contents before publishing**. This should be done by the release engineer prior to running the script.

Upon completion, this script provides instructions for tagging the Git commit that the package was created from and updating the release CHANGELOG.

**Specify a `--dry` flag when running this script if you want to skip the NPM-publish step.** In this event, the script will print the NPM commands but it will not actually run them.

#### Example usage
To publish a release to NPM as both `next` and `latest`:
```sh
scripts/release/publish.js --tags next latest
```
Loading