Skip to content

Commit 12a8d90

Browse files
author
John Kleinschmidt
committed
Change release process for 2.0
Tag release as soon as version bumps No longer use release branch Remove merge step as it is no longer needed.
1 parent baced31 commit 12a8d90

File tree

5 files changed

+24
-164
lines changed

5 files changed

+24
-164
lines changed

docs/development/releasing.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,10 @@ This release is published to [npm](https://www.npmjs.com/package/electron) under
167167
1. You can run `npm run release -- --validateRelease` to verify that all of the
168168
required files have been created for the release.
169169
170-
## Merge temporary branch
171-
Once the release builds have finished, merge the `release` branch back into
172-
the source release branch using the `merge-release` script.
173-
If the branch cannot be successfully merged back this script will automatically
174-
rebase the `release` branch and push the changes which will trigger the release
175-
builds again, which means you will need to wait for the release builds to run
176-
again before proceeding.
177-
178-
### Merging back into master
179-
```sh
180-
npm run merge-release -- master
181-
```
182-
183-
### Merging back into old release branch
184-
```sh
185-
npm run merge-release -- 1-7-x
186-
```
187170
188171
## Publish the release
189172
190-
Once the merge has finished successfully, run the `release` script
173+
Once the release builds have finished, run the `release` script
191174
via `npm run release` to finish the release process. This script will do the
192175
following:
193176
1. Build the project to validate that the correct version number is being released.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"lint-js-in-markdown": "standard-markdown docs",
5656
"create-api-json": "electron-docs-linter docs --outfile=out/electron-api.json --version=$npm_package_version",
5757
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=out/electron-api.json --out=out/electron.d.ts",
58-
"merge-release": "node ./script/merge-release.js",
5958
"mock-release": "node ./script/ci-release-build.js",
6059
"preinstall": "node -e 'process.exit(0)'",
6160
"publish-to-npm": "node ./script/publish-to-npm.js",

script/merge-release.js

Lines changed: 0 additions & 116 deletions
This file was deleted.

script/prepare-release.js

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const assert = require('assert')
66
const ciReleaseBuild = require('./ci-release-build')
77
const { execSync } = require('child_process')
88
const fail = '\u2717'.red
9-
const { GitProcess, GitError } = require('dugite')
9+
const { GitProcess } = require('dugite')
1010
const GitHub = require('github')
1111
const pass = '\u2713'.green
1212
const path = require('path')
@@ -28,24 +28,6 @@ const github = new GitHub()
2828
const gitDir = path.resolve(__dirname, '..')
2929
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
3030

31-
async function createReleaseBranch () {
32-
console.log(`Creating release branch.`)
33-
let checkoutDetails = await GitProcess.exec([ 'checkout', '-b', 'release' ], gitDir)
34-
if (checkoutDetails.exitCode === 0) {
35-
console.log(`${pass} Successfully created the release branch.`)
36-
} else {
37-
const error = GitProcess.parseError(checkoutDetails.stderr)
38-
if (error === GitError.BranchAlreadyExists) {
39-
console.log(`${fail} Release branch already exists, aborting prepare ` +
40-
`release process.`)
41-
} else {
42-
console.log(`${fail} Error creating release branch: ` +
43-
`${checkoutDetails.stderr}`)
44-
}
45-
process.exit(1)
46-
}
47-
}
48-
4931
function getNewVersion (dryRun) {
5032
console.log(`Bumping for new "${versionType}" version.`)
5133
let bumpScript = path.join(__dirname, 'bump-version.py')
@@ -98,7 +80,7 @@ async function getReleaseNotes (currentBranch) {
9880
console.log(`Checking for commits from ${pkg.version} to ${currentBranch}`)
9981
let commitComparison = await github.repos.compareCommits(githubOpts)
10082
.catch(err => {
101-
console.log(`{$fail} Error checking for commits from ${pkg.version} to ` +
83+
console.log(`${fail} Error checking for commits from ${pkg.version} to ` +
10284
`${currentBranch}`, err)
10385
process.exit(1)
10486
})
@@ -116,6 +98,7 @@ async function getReleaseNotes (currentBranch) {
11698
async function createRelease (branchToTarget, isBeta) {
11799
let releaseNotes = await getReleaseNotes(branchToTarget)
118100
let newVersion = getNewVersion()
101+
await tagRelease(newVersion)
119102
const githubOpts = {
120103
owner: 'electron',
121104
repo: 'electron'
@@ -156,25 +139,37 @@ async function createRelease (branchToTarget, isBeta) {
156139
}
157140

158141
async function pushRelease () {
159-
let pushDetails = await GitProcess.exec(['push', 'origin', 'HEAD'], gitDir)
142+
let pushDetails = await GitProcess.exec(['push', 'origin', 'HEAD', '--follow-tags'], gitDir)
160143
if (pushDetails.exitCode === 0) {
161-
console.log(`${pass} Successfully pushed the release branch. Wait for ` +
144+
console.log(`${pass} Successfully pushed the release. Wait for ` +
162145
`release builds to finish before running "npm run release".`)
163146
} else {
164-
console.log(`${fail} Error pushing the release branch: ` +
147+
console.log(`${fail} Error pushing the release: ` +
165148
`${pushDetails.stderr}`)
166149
process.exit(1)
167150
}
168151
}
169152

170-
async function runReleaseBuilds () {
171-
await ciReleaseBuild('release', {
153+
async function runReleaseBuilds (branch) {
154+
await ciReleaseBuild(branch, {
172155
ghRelease: true
173156
})
174157
}
175158

159+
async function tagRelease (version) {
160+
console.log(`Tagging release ${version}.`)
161+
let checkoutDetails = await GitProcess.exec([ 'tag', '-a', '-m', version, version ], gitDir)
162+
if (checkoutDetails.exitCode === 0) {
163+
console.log(`${pass} Successfully tagged ${version}.`)
164+
} else {
165+
console.log(`${fail} Error tagging ${version}: ` +
166+
`${checkoutDetails.stderr}`)
167+
process.exit(1)
168+
}
169+
}
170+
176171
async function verifyNewVersion () {
177-
let newVersion = await getNewVersion(true)
172+
let newVersion = getNewVersion(true)
178173
let response = await promptForVersion(newVersion)
179174
if (response.match(/^y/i)) {
180175
console.log(`${pass} Starting release of ${newVersion}`)
@@ -204,10 +199,9 @@ async function prepareRelease (isBeta, notesOnly) {
204199
console.log(`Draft release notes are: ${releaseNotes}`)
205200
} else {
206201
await verifyNewVersion()
207-
await createReleaseBranch()
208202
await createRelease(currentBranch, isBeta)
209203
await pushRelease()
210-
await runReleaseBuilds()
204+
await runReleaseBuilds(currentBranch)
211205
}
212206
}
213207

script/publish-to-npm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ new Promise((resolve, reject) => {
5050
tempDir = dirPath
5151
// copy files from `/npm` to temp directory
5252
files.forEach((name) => {
53-
const noThirdSegment = name === 'README.md' || 'LICENSE'
53+
const noThirdSegment = name === 'README.md' || name === 'LICENSE'
5454
fs.writeFileSync(
5555
path.join(tempDir, name),
5656
fs.readFileSync(path.join(__dirname, '..', noThirdSegment ? '' : 'npm', name))

0 commit comments

Comments
 (0)