Skip to content

Commit 386cea9

Browse files
committed
Add helper function to check token
1 parent 2de1e29 commit 386cea9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

script/release

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ const util = require('util')
99
const token = process.env.ELECTRON_API_DEMO_GITHUB_TOKEN
1010
const version = require('../package').version
1111

12-
if (!token) {
13-
console.error('ELECTRON_API_DEMO_GITHUB_TOKEN environment variable not set')
14-
console.error('Set it to a token with repo scope created from https://github.com/settings/tokens/new')
15-
process.exit(1)
12+
const checkToken = () => {
13+
if (!token) {
14+
return Promise.reject('ELECTRON_API_DEMO_GITHUB_TOKEN environment variable not set\nSet it to a token with repo scope created from https://github.com/settings/tokens/new')
15+
} else {
16+
return Promise.resolve()
17+
}
1618
}
1719

1820
const zipAsset = (asset) => {
@@ -150,7 +152,8 @@ const publishRelease = (release) => {
150152
})
151153
}
152154

153-
zipAssets()
155+
checkToken()
156+
.then(zipAssets)
154157
.then(createRelease)
155158
.then(uploadAssets)
156159
.then(publishRelease)

0 commit comments

Comments
 (0)