2016-10-18 04:41:57 +00:00
# Releasing
This document describes the process for releasing a new version of Electron.
2017-12-04 16:13:22 +00:00
## Set your tokens and environment variables
2018-03-07 07:32:36 +00:00
You'll need Electron S3 credentials in order to create and
upload an Electron release. Contact a team member for more
information.
2017-12-04 16:13:22 +00:00
There are a handful of `*_TOKEN` environment variables needed by the release
2018-07-11 18:02:41 +00:00
scripts:
2017-12-04 16:13:22 +00:00
* `ELECTRON_GITHUB_TOKEN` :
2018-07-11 18:02:41 +00:00
Create this by visiting https://github.com/settings/tokens/new?scopes=repo
2017-12-04 16:13:22 +00:00
* `APPVEYOR_TOKEN` :
Create a token from https://windows-ci.electronjs.org/api-token
If you don't have an account, ask a team member to add you.
* `CIRCLE_TOKEN` :
Create a token from "Personal API Tokens" at https://circleci.com/account/api
2018-07-12 12:53:07 +00:00
* `VSTS_TOKEN` :
2018-07-16 14:39:31 +00:00
Create a Personal Access Token at https://github.visualstudio.com/_usersSettings/tokens or https://github.visualstudio.com/_details/security/tokens
2018-07-12 12:53:07 +00:00
with the scope of `Build (read and execute)` .
2018-07-13 19:42:36 +00:00
* `ELECTRON_S3_BUCKET` :
* `ELECTRON_S3_ACCESS_KEY` :
* `ELECTRON_S3_SECRET_KEY` :
If you don't have these, ask a team member to help you.
2018-07-12 12:53:07 +00:00
2018-07-11 18:02:41 +00:00
Once you've generated these tokens, put them in a `.env` file in the root directory
of the project. This file is gitignored, and will be loaded into the
environment by the release scripts.
2018-07-13 20:02:49 +00:00
2018-07-12 12:53:07 +00:00
## Determine which branch to release from
- **If releasing beta,** run the scripts below from `master` .
- **If releasing a stable version,** run the scripts below from the branch
you're stabilizing.
## Find out what version change is needed
Run `npm run prepare-release -- --notesOnly` to view auto generated release
notes. The notes generated should help you determine if this is a major, minor,
patch, or beta version change. Read the
[Version Change Rules ](../tutorial/electron-versioning.md#semver ) for more information.
**NB:** If releasing from a branch, e.g. 1-8-x, check out the branch with
`git checkout 1-8-x` rather than `git checkout -b remotes/origin/1-8-x` .
The scripts need `git rev-parse --abbrev-ref HEAD` to return a short name,
e.g. no `remotes/origin/`
2017-12-04 16:13:22 +00:00
2017-10-23 15:02:50 +00:00
## Run the prepare-release script
The prepare release script will do the following:
1. Check if a release is already in process and if so it will halt.
2. Create a release branch.
2018-03-07 07:32:36 +00:00
3. Bump the version number in several files. See [this bump commit] for an example.
4. Create a draft release on GitHub with auto-generated release notes.
5. Push the release branch.
6. Call the APIs to run the release builds.
2017-10-23 15:02:50 +00:00
Once you have determined which type of version change is needed, run the
`prepare-release` script with arguments according to your need:
- `[major|minor|patch|beta]` to increment one of the version numbers, or
- `--stable` to indicate this is a stable version
For example:
### Major version change
2016-10-18 05:04:52 +00:00
```sh
2017-10-23 15:02:50 +00:00
npm run prepare-release -- major
2016-10-18 05:04:52 +00:00
```
2017-10-23 15:02:50 +00:00
### Minor version change
2016-10-18 04:41:57 +00:00
```sh
2017-10-23 15:02:50 +00:00
npm run prepare-release -- minor
```
### Patch version change
```sh
2018-07-13 19:17:31 +00:00
npm run prepare-release -- patch --stable
2017-10-23 15:02:50 +00:00
```
### Beta version change
```sh
npm run prepare-release -- beta
```
### Promote beta to stable
```sh
npm run prepare-release -- --stable
2016-10-18 04:41:57 +00:00
```
2017-12-05 14:51:37 +00:00
Tip: You can test the new version number before running `prepare-release` with
a dry run of the `bump-version` script with the same major/minor/patch/beta
arguments, e.g.:
```sh
$ ./script/bump-version.py --bump minor --dry-run
```
2017-08-03 19:55:33 +00:00
## Wait for builds :hourglass_flowing_sand:
2018-03-07 07:32:36 +00:00
The `prepare-release` script will trigger the builds via API calls.
2017-08-03 19:55:33 +00:00
To monitor the build progress, see the following pages:
2018-07-12 12:53:07 +00:00
- [electron-release-mas-x64 ](https://github.visualstudio.com/electron/_build/index?context=allDefinitions&path=%5C&definitionId=19&_a=completed ) for MAS builds.
- [electron-release-osx-x64 ](https://github.visualstudio.com/electron/_build/index?context=allDefinitions&path=%5C&definitionId=18&_a=completed ) for OSX builds.
- [circleci.com/gh/electron/electron ](https://circleci.com/gh/electron ) for Linux builds.
- [windows-ci.electronjs.org/project/AppVeyor/electron-39ng6 ](https://windows-ci.electronjs.org/project/AppVeyor/electron-39ng6 ) for Windows 32-bit builds.
- [windows-ci.electronjs.org/project/AppVeyor/electron ](https://windows-ci.electronjs.org/project/AppVeyor/electron ) for Windows 64-bit builds.
2017-08-03 19:55:33 +00:00
## Compile release notes
2018-03-07 07:32:36 +00:00
Writing release notes is a good way to keep yourself busy while the builds are running.
For prior art, see existing releases on [the releases page].
2017-08-03 19:55:33 +00:00
Tips:
2018-03-07 07:32:36 +00:00
- Each listed item should reference a PR on electron/electron, not an issue, nor a PR from another repo like libcc.
- No need to use link markup when referencing PRs. Strings like `#123` will automatically be converted to links on github.com.
- To see the version of Chromium, V8, and Node in every version of Electron, visit [atom.io/download/electron/index.json ](https://atom.io/download/electron/index.json ).
2017-08-03 19:55:33 +00:00
### Patch releases
For a `patch` release, use the following format:
2017-11-20 06:18:24 +00:00
```sh
2017-08-03 19:55:33 +00:00
## Bug Fixes
* Fixed a cross-platform thing. #123
### Linux
* Fixed a Linux thing. #123
### macOS
* Fixed a macOS thing. #123
### Windows
* Fixed a Windows thing. #1234
2017-10-06 15:48:09 +00:00
```
### Minor releases
For a `minor` release, e.g. `1.8.0` , use this format:
2017-11-20 06:18:24 +00:00
```sh
2017-10-06 15:48:09 +00:00
## Upgrades
- Upgraded from Node `oldVersion` to `newVersion` . #123
2017-08-03 19:55:33 +00:00
## API Changes
* Changed a thing. #123
### Linux
* Changed a Linux thing. #123
### macOS
* Changed a macOS thing. #123
### Windows
* Changed a Windows thing. #123
```
2017-10-06 15:48:09 +00:00
### Major releases
2017-11-20 06:18:24 +00:00
```sh
2017-10-06 15:48:09 +00:00
## Upgrades
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
- Upgraded from Chromium `oldVersion` to `newVersion` . #123
- Upgraded from Node `oldVersion` to `newVersion` . #123
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
## Breaking API changes
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
* Changed a thing. #123
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
### Linux
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
* Changed a Linux thing. #123
2017-08-03 19:55:33 +00:00
2017-10-06 15:48:09 +00:00
### macOS
* Changed a macOS thing. #123
### Windows
* Changed a Windows thing. #123
2017-08-03 19:55:33 +00:00
## Other Changes
- Some other change. #123
```
2017-10-06 15:48:09 +00:00
### Beta releases
2017-12-04 15:48:06 +00:00
Use the same formats as the ones suggested above, but add the following note at
the beginning of the changelog:
2017-11-20 06:18:24 +00:00
```sh
2017-12-04 15:48:06 +00:00
**Note:** This is a beta release and most likely will have have some
instability and/or regressions.
2017-10-06 15:48:09 +00:00
Please file new issues for any bugs you find in it.
2017-12-04 15:48:06 +00:00
This release is published to [npm ](https://www.npmjs.com/package/electron )
under the `beta` tag and can be installed via `npm install electron@beta` .
2017-10-06 15:48:09 +00:00
```
2016-10-18 04:41:57 +00:00
## Edit the release draft
2017-12-04 15:48:06 +00:00
1. Visit [the releases page] and you'll see a new draft release with placeholder
release notes.
2017-12-04 15:50:24 +00:00
2. Edit the release and add release notes.
2018-07-12 12:53:07 +00:00
3. Click 'Save draft'. **Do not click 'Publish release'!**
4. Wait for all builds to pass before proceeding.
5. In the branch, verify that the release's files have been created:
2017-12-05 14:38:16 +00:00
```sh
$ npm run release -- --validateRelease
```
2018-07-13 19:17:31 +00:00
Note, if you need to run `--validateRelease` more than once to check the assets,
2018-07-13 19:42:36 +00:00
run it as above the first time, then `node ./script/release.js --validateRelease`
2018-07-13 19:17:31 +00:00
for subsequent calls so that you don't have to rebuild each time you want to
check the assets.
2016-10-18 04:41:57 +00:00
## Publish the release
2017-10-23 15:02:50 +00:00
Once the merge has finished successfully, run the `release` script
2017-12-04 15:51:12 +00:00
via `npm run release` to finish the release process. This script will do the
2017-10-23 15:02:50 +00:00
following:
1. Build the project to validate that the correct version number is being released.
2. Download the binaries and generate the node headers and the .lib linker used
on Windows by node-gyp to build native modules.
3. Create and upload the SHASUMS files stored on S3 for the node files.
4. Create and upload the SHASUMS256.txt file stored on the GitHub release.
5. Validate that all of the required files are present on GitHub and S3 and have
the correct checksums as specified in the SHASUMS files.
6. Publish the release on GitHub
## Publish to npm
2017-12-05 02:32:24 +00:00
Before publishing to npm, you'll need to log into npm as Electron. Optionally,
you may find [npmrc ](https://www.npmjs.com/package/npmrc ) to be a useful way
to keep Electron's profile side-by-side with your own:
```sh
$ sudo npm install -g npmrc
$ npmrc -c electron
Removing old .npmrc (default)
Activating .npmrc "electron"
```
2018-04-13 21:10:53 +00:00
The Electron account's credentials are kept by GitHub.
2017-12-05 02:32:24 +00:00
"Electron - NPM" for the URL "https://www.npmjs.com/login".
```sh
$ npm login
Username: electron
Password:
Email: (this IS public) electron@github.com
```
Publish the release to npm.
```sh
$ npm whoami
electron
$ npm run publish-to-npm
```
2018-07-13 21:17:02 +00:00
After publishing, you can check the `latest` release:
```sh
$ npm dist-tag ls electron
```
If for some reason `npm run publish-to-npm` fails,
you can tag the release manually:
```sh
$ npm dist-tag add electron@< version > < tag >
```
e.g.:
```sh
$ npm dist-tag add electron@2.0.0 latest
```
2016-10-18 04:41:57 +00:00
[the releases page]: https://github.com/electron/electron/releases
[this bump commit]: https://github.com/electron/electron/commit/78ec1b8f89b3886b856377a1756a51617bc33f5a
2018-03-07 07:32:36 +00:00
[versioning]: /docs/tutorial/electron-versioning.md
2017-08-03 20:24:18 +00:00
2018-07-12 12:53:07 +00:00
# Troubleshooting
## Rerun broken builds
If a release build fails for some reason, you can use `script/ci-release-build.js` to rerun a release build:
### Rerun all linux builds:
```sh
node script/ci-release-build.js --ci=CircleCI --ghRelease TARGET_BRANCH
(TARGET_BRANCH) is the branch you are releasing from.
```
### Rerun all macOS builds:
```sh
node script/ci-release-build.js --ci=VSTS --ghRelease TARGET_BRANCH
(TARGET_BRANCH) is the branch you are releasing from.
```
### Rerun all Windows builds:
```sh
node script/ci-release-build.js --ci=AppVeyor --ghRelease TARGET_BRANCH
(TARGET_BRANCH) is the branch you are releasing from.
```
Additionally you can pass a job name to the script to run an individual job, eg:
2018-07-16 14:39:31 +00:00
```sh
2018-07-12 12:53:07 +00:00
node script/ci-release-build.js --ci=AppVeyor --ghRelease --job=electron-x64 TARGET_BRANCH
```
2017-09-26 01:30:42 +00:00
## Fix missing binaries of a release manually
In the case of a corrupted release with broken CI machines, we might have to
2017-09-26 18:10:29 +00:00
re-upload the binaries for an already published release.
2017-09-26 01:30:42 +00:00
2017-09-29 20:11:42 +00:00
The first step is to go to the
[Releases ](https://github.com/electron/electron/releases ) page and delete the
2017-09-26 18:10:29 +00:00
corrupted binaries with the `SHASUMS256.txt` checksum file.
2017-09-26 01:30:42 +00:00
Then manually create distributions for each platform and upload them:
```sh
# Checkout the version to re-upload.
git checkout vTHE.RELEASE.VERSION
2017-09-27 04:55:56 +00:00
# Do release build, specifying one target architecture.
2017-09-26 01:30:42 +00:00
./script/bootstrap.py --target_arch [arm|x64|ia32]
./script/build.py -c R
./script/create-dist.py
# Explicitly allow overwritting a published release.
./script/upload.py --overwrite
```
2017-09-26 18:10:29 +00:00
After re-uploading all distributions, publish again to upload the checksum
2017-09-26 01:30:42 +00:00
file:
```sh
npm run release
2017-09-29 20:11:42 +00:00
```