pipe release script output to slack notifier
This commit is contained in:
Родитель
60aedf6237
Коммит
c0b2ad11e5
|
@ -4,3 +4,4 @@ node_modules/
|
|||
npm-debug.log
|
||||
.jekyll-metadata
|
||||
images/crushed
|
||||
.env
|
||||
|
|
|
@ -11,19 +11,20 @@
|
|||
"start": "script/server",
|
||||
"bootstrap": "script/bootstrap",
|
||||
"link-checker": "grunt linkChecker",
|
||||
"test": "mocha && standard",
|
||||
"test": "mocha --reporter min && standard",
|
||||
"build": "npm-run-all build-*",
|
||||
"build-releases": "script/releases",
|
||||
"build-docs": "script/docs",
|
||||
"build-awesome": "script/awesome",
|
||||
"build-userland": "script/userland",
|
||||
"build-apps": "script/apps",
|
||||
"release": "script/release"
|
||||
"release": "script/release |& script/notify"
|
||||
},
|
||||
"devDependencies": {
|
||||
"awesome-electron": "^2.5.0",
|
||||
"chai": "^3.5.0",
|
||||
"cheerio": "^0.22.0",
|
||||
"dotenv": "^4.0.0",
|
||||
"electron-apps": "github:electron/electron-apps",
|
||||
"electron-docs": "^3.0.0",
|
||||
"electron-userland-reports": "1.6.0",
|
||||
|
@ -38,6 +39,7 @@
|
|||
"npm-run-all": "^3.1.2",
|
||||
"require-dir": "^0.3.1",
|
||||
"semver": "^5.3.0",
|
||||
"slack-notify": "^0.1.6",
|
||||
"standard": "^8.6.0",
|
||||
"titlecase": "^1.0.2",
|
||||
"to-markdown": "github:zeke/to-markdown#support-markdown-it-gfm"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
// Load SLACK_WEBHOOK from .env (for local testing)
|
||||
require('dotenv').load()
|
||||
|
||||
const slack = require('slack-notify')(process.env.SLACK_WEBHOOK)
|
||||
var input = ''
|
||||
|
||||
// Collect STDOUT and STDERR from release script
|
||||
process.stdin
|
||||
.setEncoding('utf8')
|
||||
.on('readable', () => { input += String(process.stdin.read() || '') })
|
||||
.on('end', send)
|
||||
|
||||
function send () {
|
||||
if (!input.match('npm ERR') && !input.match('Test failed')) {
|
||||
return process.exit()
|
||||
}
|
||||
|
||||
const opts = {
|
||||
icon_url: 'https://avatars0.githubusercontent.com/u/18403005?v=3',
|
||||
username: 'electron.atom.io',
|
||||
text: input
|
||||
}
|
||||
|
||||
slack.send(opts, (err) => {
|
||||
if (err) throw err
|
||||
})
|
||||
}
|
Загрузка…
Ссылка в новой задаче