forked from jaywcjlove/linux-command
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
28 lines (26 loc) · 907 Bytes
/
deploy.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
var exec = require('child_process').exec;
var ghpages = require('gh-pages');
var loading = require('loading-cli');
var path = require('path');
var fs = require('fs');
var color = require('colors-cli/safe');
var error = color.red.bold;
var warn = color.yellow;
var notice = color.blue;
var success = color.green;
var deploy_path = path.join(process.cwd(), '.deploy');
if(fs.existsSync(deploy_path)){
var load = loading(' Pushing code!!')
load.start();
ghpages.publish(deploy_path,{
repo: 'https://github.com/jaywcjlove/linux-command.git',
branch: 'gh-pages',
message: 'Linux command index, Compiler generation page ' + new Date()
}, function(err) {
if(err) return console.log(error(' → '+"ok!"+err));
load.stop()
console.log(success('\n\n '+"Push success!!"));
// 删除文件夹
exec('rm -rf .deploy');
});
}