forked from serenity-js/serenity-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-pages.js
54 lines (52 loc) · 1.83 KB
/
gh-pages.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
53
54
var ghpages = require('gh-pages');
var program = require('commander');
var path = require('path');
program
.option('-d, --dist <dist>',
'base directory for all source files')
.option('-s, --src <src>',
'pattern used to select which files should be published', '**/*')
.option('-r, --repo <repo>',
'URL of the repository you\'ll be pushing to')
.option('-x, --silent', 'Do not output the repository url')
.option('-b, --branch <branch>',
'name of the branch you\'ll be pushing to', 'gh-pages')
.option('-o, --remote <name>',
'The name of the remote', 'origin')
.option('-m, --message <message>',
'commit message', 'Updates')
.option('-g, --tag <tag>',
'add tag to commit')
.option('-t, --dotfiles', 'Include dotfiles')
.option('-a, --add', 'Only add, and never remove existing files.')
.option('-v, --remove <pattern>',
'Remove files that match the given pattern ' +
'(ignored if used together with --add).', '.')
.option('-n, --no-push', 'Commit only (with no push)')
.parse(process.argv);
ghpages.publish(path.join(process.cwd(), program.dist), {
repo: 'https://' + process.env.GH_TOKEN + '@github.com/jan-molak/serenity-js.git',
silent: !!program.silent,
branch: program.branch,
src: program.src,
message: program.message,
tag: program.tag,
dotfiles: !!program.dotfiles,
add: !!program.add,
only: program.remove,
remote: program.remote,
push: !program.noPush,
user: {
name: 'smartcode-devbot',
email: '[email protected]'
},
logger: function(message) {
process.stderr.write(message + '\n');
}
}, function(err) {
if (err) {
process.stderr.write(err.message + '\n');
return process.exit(1);
}
process.stderr.write('Published\n');
});