forked from microsoft/vscode-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (52 loc) · 1.72 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
const gulp = require('gulp')
const $ = require('shelljs')
const GITHUB_TOKEN = process.env['GITHUB_TOKEN']
const BRANCH = process.env['BUILD_SOURCEBRANCHNAME']
if (!GITHUB_TOKEN) {
$.echo('This script clones vscode-website and requires access token')
$.exit(1)
}
const URL = `https://${GITHUB_TOKEN}@github.com/microsoft/vscode-website`
const TAS_URL = `https://${GITHUB_TOKEN}@github.com/microsoft/TryAppServiceClient`
/**
* This task
* - Clones vscode-website
* - Clones vscode-website-dist
* - Uses vscode-docs:[current-branch] + vscode-website:prod to build to vscode-website-dist:[current-branch]
*/
gulp.task('build-dist', done => {
if (!$.which('git')) {
$.echo('This command requires git')
$.exit(1)
done()
}
// Go to _build
if (!$.test('-e', '_build')) {
$.mkdir('_build')
}
$.cd('_build')
// Clone prod branch of vscode-website
// If it exists, upgrade to latest
if (!$.test('-e', 'vscode-website')) {
$.exec(`git clone --depth=1 --branch=prod ${URL}`)
} else {
$.cd('vscode-website')
$.exec('git pull origin prod')
$.cd('..')
}
// Copy over MD/asset files
$.mkdir('vscode-website/vscode-docs')
$.cp('-R', ['../blogs', '../docs', '../images', '../release-notes', '../tutorials', '../build'], 'vscode-website/vscode-docs')
// Clone tas-client
$.exec(`git clone ${TAS_URL} vscode-website/tas-client`)
$.cd('vscode-website/tas-client')
$.exec('git checkout tags/v1.4-beta')
$.cd('../..')
// Go to vscode-website
$.cd('vscode-website')
// Run setup to fetch vscode-website-dist
$.echo('BRANCH is ' + BRANCH)
$.exec(`scripts/setup.sh ${GITHUB_TOKEN} ${BRANCH}`)
// Run build to sync changes to vscode-website-dist
$.exec(`scripts/build.sh ${BRANCH}`)
})