Skip to content

Commit 1d0dfd5

Browse files
author
John Kleinschmidt
authored
Release process updates for 1-7-x (electron#10643)
* Add prerelease script * Update CircleCI for releases * Rerun builds
1 parent 5b679cb commit 1d0dfd5

File tree

3 files changed

+277
-3
lines changed

3 files changed

+277
-3
lines changed

.circleci/config.yml

Lines changed: 162 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,186 @@ jobs:
66
- image: electronbuilds/electron:0.0.3
77
environment:
88
TARGET_ARCH: arm
9+
resource_class: xlarge
910
steps:
1011
- checkout
11-
- run: script/cibuild
12+
- run: sh -e /etc/init.d/xvfb start
13+
- run:
14+
name: Check for release
15+
command: |
16+
MESSAGE="$(git log --format=%B -n 1 HEAD)"
17+
case ${MESSAGE} in
18+
Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
19+
esac
20+
- run:
21+
name: Bootstrap
22+
command: |
23+
if [ "$ELECTRON_RELEASE" == "1" ]; then
24+
echo 'Bootstrapping Electron for release build'
25+
script/bootstrap.py --target_arch=$TARGET_ARCH
26+
else
27+
echo 'Bootstrapping Electron for debug build'
28+
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
29+
fi
30+
- run: npm run lint
31+
- run:
32+
name: Build
33+
command: |
34+
if [ "$ELECTRON_RELEASE" == "1" ]; then
35+
echo 'Building Electron for release'
36+
script/build.py -c R
37+
else
38+
echo 'Building Electron for debug'
39+
script/build.py -c D
40+
fi
41+
- run:
42+
name: Create distribution
43+
command: |
44+
if [ "$ELECTRON_RELEASE" == "1" ]; then
45+
echo 'Creating Electron release distribution'
46+
script/create-dist.py
47+
else
48+
echo 'Skipping create distribution because build is not for release'
49+
fi
50+
- run:
51+
name: Upload distribution
52+
command: |
53+
if [ "$ELECTRON_RELEASE" == "1" ]; then
54+
echo 'Uploading Electron release distribution'
55+
script/upload.py
56+
else
57+
echo 'Skipping upload distribution because build is not for release'
58+
fi
1259
1360
electron-linux-ia32:
1461
docker:
1562
- image: electronbuilds/electron:0.0.3
1663
environment:
1764
TARGET_ARCH: ia32
65+
resource_class: xlarge
1866
steps:
1967
- checkout
20-
- run: script/cibuild
68+
- run: sh -e /etc/init.d/xvfb start
69+
- run:
70+
name: Check for release
71+
command: |
72+
MESSAGE="$(git log --format=%B -n 1 HEAD)"
73+
case ${MESSAGE} in
74+
Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
75+
esac
76+
- run:
77+
name: Bootstrap
78+
command: |
79+
if [ "$ELECTRON_RELEASE" == "1" ]; then
80+
echo 'Bootstrapping Electron for release build'
81+
script/bootstrap.py --target_arch=$TARGET_ARCH
82+
else
83+
echo 'Bootstrapping Electron for debug build'
84+
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
85+
fi
86+
- run: npm run lint
87+
- run:
88+
name: Build
89+
command: |
90+
if [ "$ELECTRON_RELEASE" == "1" ]; then
91+
echo 'Building Electron for release'
92+
script/build.py -c R
93+
else
94+
echo 'Building Electron for debug'
95+
script/build.py -c D
96+
fi
97+
- run:
98+
name: Create distribution
99+
command: |
100+
if [ "$ELECTRON_RELEASE" == "1" ]; then
101+
echo 'Creating Electron release distribution'
102+
script/create-dist.py
103+
else
104+
echo 'Skipping create distribution because build is not for release'
105+
fi
106+
- run:
107+
name: Upload distribution
108+
command: |
109+
if [ "$ELECTRON_RELEASE" == "1" ]; then
110+
echo 'Uploading Electron release distribution'
111+
script/upload.py
112+
else
113+
echo 'Skipping upload distribution because build is not for release'
114+
fi
21115
22116
electron-linux-x64:
23117
docker:
24118
- image: electronbuilds/electron:0.0.3
25119
environment:
26120
TARGET_ARCH: x64
121+
resource_class: xlarge
27122
steps:
28123
- checkout
29-
- run: script/cibuild
124+
- run: sh -e /etc/init.d/xvfb start
125+
- run:
126+
name: Check for release
127+
command: |
128+
MESSAGE="$(git log --format=%B -n 1 HEAD)"
129+
case ${MESSAGE} in
130+
Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
131+
esac
132+
- run:
133+
name: Bootstrap
134+
command: |
135+
if [ "$ELECTRON_RELEASE" == "1" ]; then
136+
echo 'Bootstrapping Electron for release build'
137+
script/bootstrap.py --target_arch=$TARGET_ARCH
138+
else
139+
echo 'Bootstrapping Electron for debug build'
140+
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
141+
fi
142+
- run: npm run lint
143+
- run:
144+
name: Build
145+
command: |
146+
if [ "$ELECTRON_RELEASE" == "1" ]; then
147+
echo 'Building Electron for release'
148+
script/build.py -c R
149+
else
150+
echo 'Building Electron for debug'
151+
script/build.py -c D
152+
fi
153+
- run:
154+
name: Create distribution
155+
command: |
156+
if [ "$ELECTRON_RELEASE" == "1" ]; then
157+
echo 'Creating Electron release distribution'
158+
script/create-dist.py
159+
else
160+
echo 'Skipping create distribution because build is not for release'
161+
fi
162+
- run:
163+
name: Upload distribution
164+
command: |
165+
if [ "$ELECTRON_RELEASE" == "1" ]; then
166+
echo 'Uploading Electron release distribution'
167+
script/upload.py
168+
else
169+
echo 'Skipping upload distribution because build is not for release'
170+
fi
171+
- run:
172+
name: Test
173+
command: |
174+
if [ "$ELECTRON_RELEASE" != "1" ]; then
175+
echo 'Testing Electron debug build'
176+
script/test.py --ci --rebuild_native_modules
177+
else
178+
echo 'Skipping testing on release build'
179+
fi
180+
- run:
181+
name: Verify FFmpeg
182+
command: |
183+
if [ "$ELECTRON_RELEASE" != "1" ]; then
184+
echo 'Verifying ffmpeg on debug build'
185+
script/verify-ffmpeg.py
186+
else
187+
echo 'Skipping verify ffmpeg on release build'
188+
fi
30189
31190
workflows:
32191
version: 2

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
"devDependencies": {
77
"asar": "^0.11.0",
88
"browserify": "^13.1.0",
9+
"colors": "^1.1.2",
910
"check-for-leaks": "^1.0.2",
1011
"dotenv-safe": "^4.0.4",
1112
"electabul": "~0.0.4",
1213
"electron-docs-linter": "^2.3.3",
1314
"electron-typescript-definitions": "^1.2.7",
1415
"github": "^9.2.0",
16+
"heads": "^1.3.0",
1517
"husky": "^0.14.3",
1618
"request": "^2.68.0",
1719
"standard": "^8.4.0",
@@ -48,6 +50,7 @@
4850
"create-api-json": "electron-docs-linter docs --outfile=out/electron-api.json --version=$npm_package_version",
4951
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=out/electron-api.json --out=out/electron.d.ts",
5052
"preinstall": "node -e 'process.exit(0)'",
53+
"prerelease": "node ./script/prerelease",
5154
"publish-to-npm": "node ./script/publish-to-npm.js",
5255
"prepack": "check-for-leaks",
5356
"prepush": "check-for-leaks",

script/prerelease.js

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/usr/bin/env node
2+
3+
require('colors')
4+
const assert = require('assert')
5+
const GitHub = require('github')
6+
const heads = require('heads')
7+
const pkg = require('../package.json')
8+
const pass = '\u2713'.green
9+
const fail = '\u2717'.red
10+
let failureCount = 0
11+
12+
assert(process.env.ELECTRON_GITHUB_TOKEN, 'ELECTRON_GITHUB_TOKEN not found in environment')
13+
14+
const github = new GitHub()
15+
github.authenticate({type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN})
16+
github.repos.getReleases({owner: 'electron', repo: 'electron'})
17+
.then(res => {
18+
const releases = res.data
19+
const drafts = releases
20+
.filter(release => release.draft) // comment out for testing
21+
// .filter(release => release.tag_name === 'v1.7.5') // uncomment for testing
22+
23+
check(drafts.length === 1, 'one draft exists', true)
24+
const draft = drafts[0]
25+
26+
check(draft.tag_name === `v${pkg.version}`, `draft release version matches local package.json (v${pkg.version})`)
27+
check(draft.prerelease, 'draft is a prerelease')
28+
check(draft.body.length > 50 && !draft.body.includes('(placeholder)'), 'draft has release notes')
29+
30+
const requiredAssets = assetsForVersion(draft.tag_name).sort()
31+
const extantAssets = draft.assets.map(asset => asset.name).sort()
32+
33+
requiredAssets.forEach(asset => {
34+
check(extantAssets.includes(asset), asset)
35+
})
36+
37+
const s3Urls = s3UrlsForVersion(draft.tag_name)
38+
heads(s3Urls)
39+
.then(results => {
40+
results.forEach((result, i) => {
41+
check(result === 200, s3Urls[i])
42+
})
43+
44+
process.exit(failureCount > 0 ? 1 : 0)
45+
})
46+
.catch(err => {
47+
console.error('Error making HEAD requests for S3 assets')
48+
console.error(err)
49+
process.exit(1)
50+
})
51+
})
52+
53+
function check (condition, statement, exitIfFail = false) {
54+
if (condition) {
55+
console.log(`${pass} ${statement}`)
56+
} else {
57+
failureCount++
58+
console.log(`${fail} ${statement}`)
59+
if (exitIfFail) process.exit(1)
60+
}
61+
}
62+
63+
function assetsForVersion (version) {
64+
const patterns = [
65+
'electron-{{VERSION}}-darwin-x64-dsym.zip',
66+
'electron-{{VERSION}}-darwin-x64-symbols.zip',
67+
'electron-{{VERSION}}-darwin-x64.zip',
68+
'electron-{{VERSION}}-linux-arm-symbols.zip',
69+
'electron-{{VERSION}}-linux-arm.zip',
70+
'electron-{{VERSION}}-linux-armv7l-symbols.zip',
71+
'electron-{{VERSION}}-linux-armv7l.zip',
72+
'electron-{{VERSION}}-linux-ia32-symbols.zip',
73+
'electron-{{VERSION}}-linux-ia32.zip',
74+
'electron-{{VERSION}}-linux-x64-symbols.zip',
75+
'electron-{{VERSION}}-linux-x64.zip',
76+
'electron-{{VERSION}}-mas-x64-dsym.zip',
77+
'electron-{{VERSION}}-mas-x64-symbols.zip',
78+
'electron-{{VERSION}}-mas-x64.zip',
79+
'electron-{{VERSION}}-win32-ia32-pdb.zip',
80+
'electron-{{VERSION}}-win32-ia32-symbols.zip',
81+
'electron-{{VERSION}}-win32-ia32.zip',
82+
'electron-{{VERSION}}-win32-x64-pdb.zip',
83+
'electron-{{VERSION}}-win32-x64-symbols.zip',
84+
'electron-{{VERSION}}-win32-x64.zip',
85+
'electron-api.json',
86+
'electron.d.ts',
87+
'ffmpeg-{{VERSION}}-darwin-x64.zip',
88+
'ffmpeg-{{VERSION}}-linux-arm.zip',
89+
'ffmpeg-{{VERSION}}-linux-armv7l.zip',
90+
'ffmpeg-{{VERSION}}-linux-ia32.zip',
91+
'ffmpeg-{{VERSION}}-linux-x64.zip',
92+
'ffmpeg-{{VERSION}}-mas-x64.zip',
93+
'ffmpeg-{{VERSION}}-win32-ia32.zip',
94+
'ffmpeg-{{VERSION}}-win32-x64.zip'
95+
]
96+
return patterns.map(pattern => pattern.replace(/{{VERSION}}/g, version))
97+
}
98+
99+
function s3UrlsForVersion (version) {
100+
const bucket = 'https://gh-contractor-zcbenz.s3.amazonaws.com/'
101+
const patterns = [
102+
'atom-shell/dist/{{VERSION}}/iojs-{{VERSION}}-headers.tar.gz',
103+
'atom-shell/dist/{{VERSION}}/iojs-{{VERSION}}.tar.gz',
104+
'atom-shell/dist/{{VERSION}}/node-{{VERSION}}.tar.gz',
105+
'atom-shell/dist/{{VERSION}}/node.lib',
106+
'atom-shell/dist/{{VERSION}}/win-x64/iojs.lib',
107+
'atom-shell/dist/{{VERSION}}/win-x86/iojs.lib',
108+
'atom-shell/dist/{{VERSION}}/x64/node.lib',
109+
'atom-shell/dist/index.json'
110+
]
111+
return patterns.map(pattern => bucket + pattern.replace(/{{VERSION}}/g, version))
112+
}

0 commit comments

Comments
 (0)