-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
33 lines (26 loc) · 876 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
29
30
31
32
33
const {resolve} = require('path');
const {emptyDirSync, copySync, removeSync} = require('fs-extra');
const {execSync} = require('child_process');
const rimraf = require('rimraf');
function exec(command) {
execSync(command, {stdio: 'inherit'});
}
function deploy() {
const deploy = resolve('./deploy');
const build = resolve('./build');
const here = process.cwd();
emptyDirSync(deploy);
exec(`git clone git@github.com:DreadBoy/giraffe.git ${deploy}`);
process.chdir(deploy);
exec('git checkout gh-pages');
rimraf.sync(`${deploy}/*`)
process.chdir(here);
exec('yarn run build');
copySync(build, deploy)
process.chdir(deploy);
exec(`git add . && git commit --allow-empty -m "Deployed at ${new Date().toISOString()} " && git push`);
process.chdir(here);
removeSync(deploy);
removeSync(build);
}
deploy();