forked from zackexplosion/rip-g8iker.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshipitfile.js
48 lines (42 loc) · 1.25 KB
/
shipitfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module.exports = function (shipit) {
require('shipit-deploy')(shipit)
shipit.initConfig({
// branch: 'supplier-login',
default: {
workspace: '/tmp/github-monitor',
deployTo: '/app/rip-g8iker',
repositoryUrl: 'https://github.com/zackexplosion/rip-g8iker.com',
},
production: {
servers: 'zack@YEE'
}
})
shipit.on('deployed', async function () {
// var shared_path = `${shipit.config.deployTo}/shared`
try {
await shipit.remote(`cd ${shipit.currentPath} && nvm use && yarn`)
// await Promise.all([
// shipit.local('yarn build'),
// shipit.remote(`ln -nfs ${shared_path}/.env ${shipit.currentPath}/.env`)
// ])
// await shipit.l¡ocal('yarn build'),
// await shipit.start('assets:push')
await shipit.copyToRemote(
'./build',
shipit.currentPath,
)
} catch (error) {
console.log(error)
}
shipit.start('startApp')
})
shipit.task('startApp', async () => {
const name = 'rip-g8iker'
const current_path = `${shipit.config.deployTo}/current`
try {
await shipit.remote(`pm2 start ${current_path}/server.js --name ${name}`)
} catch (error) {
await shipit.remote(`pm2 restart ${name}`)
}
})
}