Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 645ee87

Browse files
committed
Merge branch 'master' of github.com:coderplex/coderplex-website
2 parents dbf5e8e + 47ea4c4 commit 645ee87

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

scripts/deploy.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ if (!process.env.CI || !process.env.TRAVIS) {
5050
const githubToken = process.env.GH_TOKEN;
5151
const nowToken = process.env.NOW_TOKEN;
5252
const discordHook = process.env.DISCORD_HOOK;
53-
const prSha = process.env.TRAVIS_PULL_REQUEST_SHA;
54-
const commitSha = process.env.TRAVIS_COMMIT;
5553
const repoSlug = process.env.TRAVIS_REPO_SLUG;
5654
const aliasUrl = process.env.NOW_ALIAS;
5755

@@ -116,7 +114,7 @@ function notifyInDiscord(err, res) {
116114
content: buildComment(res.context, res.url, 'https://coderplex.org'),
117115
})
118116
.then(() => {
119-
console.log(`Error posted to discord`);
117+
console.log(`Success posted to discord`);
120118
})
121119
.catch(console.log.bind(console));
122120
}
@@ -128,6 +126,8 @@ function buildComment(context, url, aliasUrl) {
128126
}
129127

130128
function deploy(context, sha) {
129+
console.log(`context: ${context}`);
130+
console.log(`sha: ${sha}`);
131131
if (context === 'staging') {
132132
// Send error status to github PR
133133
ghRepo.status(
@@ -163,7 +163,7 @@ function deploy(context, sha) {
163163

164164
// Retrieve now.sh unique url from stdOut
165165
const deployedUrl = getUrl(res);
166-
166+
console.log(`deployedUrl: ${deployedUrl}`);
167167
if (context === 'staging') {
168168
// Send success status to github PR
169169
ghRepo.status(
@@ -177,14 +177,12 @@ function deploy(context, sha) {
177177
console.log.bind(console),
178178
);
179179
// Check and create comment on github PR abot deployment results
180-
if (argv.comment && context === 'staging') {
181-
ghIssue.createComment(
182-
{
183-
body: buildComment(context, deployedUrl),
184-
},
185-
console.log.bind(console),
186-
);
187-
}
180+
ghIssue.createComment(
181+
{
182+
body: buildComment(context, deployedUrl),
183+
},
184+
console.log.bind(console),
185+
);
188186
return;
189187
}
190188
// In production alias deployment to specified alias url from now.json file or from env variable
@@ -207,9 +205,9 @@ travisAfterAll((code, err) => {
207205
if (err || code) return;
208206
switch (process.env.TRAVIS_EVENT_TYPE) {
209207
case 'pull_request':
210-
return deploy('staging', prSha);
208+
return deploy('staging', process.env.TRAVIS_PULL_REQUEST_SHA);
211209
case 'push':
212-
return deploy('production', commitSha);
210+
return deploy('production', process.env.TRAVIS_COMMIT);
213211
default:
214212
break;
215213
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy