forked from netlify/staticgen
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathshipitfile.js
52 lines (41 loc) · 1.36 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
49
50
51
52
var copyObject = require('copy-object');
module.exports = function (shipit) {
require('shipit-deploy')(shipit);
var
config = {
servers: '[email protected]:22022',
workspace: '/tmp/jspreadsheets.com',
repositoryUrl: 'https://github.com/krzysztofspilka/staticgen.git',
ignores: ['.git', 'node_modules'],
rsync: ['--force', '--delete', '--delete-excluded', '-I', '--stats', '--chmod=ug=rwX'],
keepReleases: 3,
shallowClone: false
};
shipit.initConfig({
production: (function() {
config = copyObject(config);
config.branch = 'master';
config.deployTo = '/home/httpd/jspreadsheets.com';
return config;
}()),
development: (function() {
config = copyObject(config);
config.branch = 'develop';
config.deployTo = '/home/httpd/dev.jspreadsheets.com';
return config;
}())
});
shipit.task('test', function() {
shipit.remote('pwd');
});
shipit.blTask('deploy', ['deploy:init', 'deploy:fetch', 'deploy:update']);
shipit.on('updated', function() {
const dirname = shipit.releaseDirname;
shipit.remote(`cd ${shipit.config.deployTo} && ./build.sh ${dirname}`).then(function() {
shipit.start(['deploy:publish', 'deploy:clean']);
});
});
shipit.on('published', function() {
shipit.remote(`cd ${shipit.config.deployTo} && ./up.sh`);
});
};