forked from microsoft/vscode-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (59 loc) · 2.17 KB
/
gulpfile.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var git = require('gulp-git');
var fs = require('fs');
var runSequence = require('run-sequence');
var rimraf = require('rimraf');
var common = require('./scripts/gulpfile.common.js');
require('./scripts/gulpfile.docs.js');
require('./scripts/gulpfile.releasenotes.js');
require('./scripts/gulpfile.api.js');
require('./scripts/gulpfile.blog.js');
var BRANCH = process.env["branch"] ? process.env["branch"] : "master";
var URL = process.env["token"] ? 'https://' + process.env["token"] + '@github.com/microsoft/vscode-website': 'https://github.com/microsoft/vscode-website';
gulp.task('compile-all', ['compile-docs', 'compile-releasenotes', 'compile-blog']);
gulp.task('clean-out-folder', common.rimraf('out'));
gulp.task('clone-vscode-website', ['clean-out-folder'], function(cb){
fs.mkdir('out');
process.chdir('./out');
git.clone(URL, function (err) {
if (err) {
console.log('could not clone vscode-website')
console.log(err);
cb(err);
} else {
process.chdir('./vscode-website');
git.checkout(BRANCH, function(error) {
console.log('checked out branch:', BRANCH);
process.chdir('../../');
cb(error);
});
}
});
});
gulp.task('commit', function(){
process.chdir('./out/vscode-website');
return gulp.src(['./*' ], {buffer:false})
.pipe(git.add())
.pipe(git.commit('syncing with vscode-docs'))
});
gulp.task('push', function(cb){
git.push(URL, BRANCH, {args:"-f"}, function(error) {
if (!error) {
console.log('successfully pushed to branch:', BRANCH);
}
cb(error);
});
});
gulp.task('build-website', function(cb){
runSequence('compile',
'clone-vscode-website',
'generate-api-doc',
'compile-all');
});
gulp.task('sync', function(cb){
runSequence('commit','push');
});