From 1d2b6bc3e1da15751447102532a6093a4871ff96 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Fri, 7 Jul 2017 22:05:36 +0200 Subject: [PATCH] Don't check node version when uploading binary to Slack --- scripts/slack.js | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/scripts/slack.js b/scripts/slack.js index b37dc9e..7ff831c 100755 --- a/scripts/slack.js +++ b/scripts/slack.js @@ -11,8 +11,6 @@ const branch = process.env.CIRCLE_BRANCH const apiKey = process.env.SLACK_TOKEN const channel = process.env.SLACK_CHANNEL const githubToken = process.env.GITHUB_TOKEN -const currentNodeVersion = process.version -const regex = /^(node|7)\.*/ // Skip if not on a zeit repo if (!/^zeit\//.test(repo)) { @@ -49,28 +47,20 @@ fetch(`https://api.github.com/repos/${repo}/commits/${commit}`, opts) authorUrl: res.author.html_url })) .then(async res => { - if (regex.test(currentNodeVersion)) { - const message = `:package: Here are the binaries for the branch *${branch}* of *${repo}* (commit by <${res.authorUrl}|${res.authorName}>):` + const message = `:package: Here are the binaries for the branch *${branch}* of *${repo}* (commit by <${res.authorUrl}|${res.authorName}>):` - const binaries = [ - `${__dirname}/../packed/now-macos`, - `${__dirname}/../packed/now-linux`, - `${__dirname}/../packed/now-win.exe` - ] + const binaries = [ + `${__dirname}/../packed/now-macos`, + `${__dirname}/../packed/now-linux`, + `${__dirname}/../packed/now-win.exe` + ] - try { - await slackup({ apiKey, channel, type: 'message', message }) - await slackup({ apiKey, channel, type: 'file', filePath: binaries[0] }) - await slackup({ apiKey, channel, type: 'file', filePath: binaries[1] }) - await slackup({ apiKey, channel, type: 'file', filePath: binaries[2] }) - } catch (err) { - console.log(`Couldn't send messages/files to Slack`, err) - } - } else { - setTimeout(async () => { - const message = `:white_check_mark: Build succeded on Node ${currentNodeVersion} (commit by <${res.authorUrl}|${res.authorName}>)` - await slackup({ apiKey, channel, type: 'message', message }) - }, 10000) + try { + await slackup({ apiKey, channel, type: 'message', message }) + await slackup({ apiKey, channel, type: 'file', filePath: binaries[0] }) + await slackup({ apiKey, channel, type: 'file', filePath: binaries[1] }) + await slackup({ apiKey, channel, type: 'file', filePath: binaries[2] }) + } catch (err) { + console.log(`Couldn't send messages/files to Slack`, err) } - }) - .catch(console.error) + }).catch(console.error)