Automate release (#10827)

* Create prepare-release script

* Add script to merge release

* Cleanup/add logging

* Move release process out of upload.py

* Add cleanup release branch

* Update release doc to reflect new scripts

* Fix to allow running with notesOnly

Also fixup release name and body when beta release.

* Fix issues found during release

* Use getRelease instead of getAssets

github.repos.getAssets is limited to 30 entries which means we may not get back the file we are looking for.

* Documentation corrections
This commit is contained in:
John Kleinschmidt 2017-10-23 11:02:50 -04:00 committed by GitHub
parent 67f0eb7b3b
commit 66846bff97
10 changed files with 836 additions and 242 deletions

View file

@ -2,47 +2,51 @@
This document describes the process for releasing a new version of Electron.
## Find out what version change is needed
Is this a major, minor, patch, or beta version change? Read the [Version Change Rules](../tutorial/electron-versioning.md#version-change-rules) to find out.
## Create a temporary branch
## Determine which branch to release from
- **If releasing beta,** create a new branch from `master`.
- **If releasing a stable version,** create a new branch from the beta branch you're stablizing.
- **If releasing a stable version,** create a new branch from the beta branch you're stabilizing.
Name the new branch `release` or anything you like.
## 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#version-change-rules) for more information.
## 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.
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 so that the release builds get built.
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
```sh
git checkout master
git pull
git checkout -b release
npm run prepare-release -- major
```
This branch is created as a precaution to prevent any merged PRs from sneaking into a release between the time the temporary release branch is created and the CI builds are complete.
## Check for extant drafts
The upload script [looks for an existing draft release](https://github.com/electron/electron/blob/7961a97d7ddbed657c6c867cc8426e02c236c077/script/upload.py#L173-L181). To prevent your new release
from clobbering an existing draft, check [the releases page] and
make sure there are no drafts.
## Bump the version
Run the `bump-version` script with arguments according to your need:
- `--bump=[major|minor|patch|beta]` to increment one of the version numbers, or
- `--stable` to indicate this is a stable version, or
- `--version={version}` to set version number directly.
**Note**: you can use both `--bump` and `--stable` simultaneously.
There is also a `dry-run` flag you can use to make sure the version number generated is correct before committing.
### Minor version change
```sh
npm run bump-version -- --bump=patch --stable
git push origin HEAD
npm run prepare-release -- minor
```
### Patch version change
```sh
npm run prepare-release -- patch
```
### Beta version change
```sh
npm run prepare-release -- beta
```
### Promote beta to stable
```sh
npm run prepare-release -- --stable
```
This will bump the version number in several files. See [this bump commit] for an example.
## Wait for builds :hourglass_flowing_sand:
@ -159,65 +163,46 @@ This release is published to [npm](https://www.npmjs.com/package/electron) under
1. Uncheck the `prerelease` checkbox if you're publishing a stable release; leave it checked for beta releases.
1. Click 'Save draft'. **Do not click 'Publish release'!**
1. Wait for all builds to pass before proceeding.
1. You can run `npm run release --validateRelease` to verify that all of the
required files have been created for the release.
## Merge temporary branch
Once the release builds have finished, merge the `release` branch back into
the source release branch using the `merge-release` script.
If the branch cannot be successfully merged back this script will automatically
rebase the `release` branch and push the changes which will trigger the release
builds again, which means you will need to wait for the release builds to run
again before proceeding.
Merge the temporary branch back into master, without creating a merge commit:
### Merging back into master
```sh
git checkout master
git merge release --no-commit
git push origin master
npm run merge-release -- master
```
If this fails, rebase with master and rebuild:
### Merging back into old release branch
```sh
git pull
git checkout release
git rebase master
git push origin HEAD
npm run merge-release -- 1-7-x
```
## Run local debug build
Run local debug build to verify that you are actually building the version you want. Sometimes you thought you were doing a release for a new version, but you're actually not.
```sh
npm run build
npm start
```
Verify the window is displaying the current updated version.
## Set environment variables
You'll need to set the following environment variables to publish a release. Ask another team member for these credentials.
- `ELECTRON_S3_BUCKET`
- `ELECTRON_S3_ACCESS_KEY`
- `ELECTRON_S3_SECRET_KEY`
- `ELECTRON_GITHUB_TOKEN` - A personal access token with "repo" scope.
You will only need to do this once.
## Publish the release
This script will download the binaries and generate the node headers and the .lib linker used on Windows by node-gyp to build native modules.
Once the merge has finished successfully, run the `release` script
via `npm run release` to finish the release process. This script will do the
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
7. Delete the `release` branch.
```sh
npm run release
```
## Publish to npm
Note: Many distributions of Python still ship with old HTTPS certificates. You may see a `InsecureRequestWarning`, but it can be disregarded.
## Delete the temporary branch
```sh
git checkout master
git branch -D release # delete local branch
git push origin :release # delete remote branch
```
Once the publish is successful, run `npm run publish-to-npm` to publish to
release to npm.
[the releases page]: https://github.com/electron/electron/releases
[this bump commit]: https://github.com/electron/electron/commit/78ec1b8f89b3886b856377a1756a51617bc33f5a