This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.babel.js
87 lines (76 loc) · 2.25 KB
/
gulpfile.babel.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// (C) Copyright 2016 Hewlett Packard Enterprise Development LP
import del from 'del';
import git from 'gulp-git';
import gulp from 'gulp';
import grommetToolbox from 'grommet-toolbox';
import mkdirp from 'mkdirp';
gulp.task('release:createTmp', function(done) {
del.sync(['./tmp']);
mkdirp('./tmp', function(err) {
if (err) {
throw err;
}
done();
});
});
gulp.task('release:stable', ['dist', 'release:createTmp'], function(done) {
if (process.env.CI) {
git.clone('https://' + process.env.GH_TOKEN +
'@github.com/grommet/grommet-addons.git',
{
cwd: './tmp/'
},
function(err) {
if (err) {
throw err;
}
process.chdir('./tmp/grommet-addons');
git.checkout('stable', function(err) {
if (err) {
throw err;
}
del.sync(['./**/*']);
gulp.src('../../dist/**').pipe(gulp.dest('./')).on('end', function() {
git.status({
args: '--porcelain'
}, function(err, stdout) {
if (err) {
throw err;
}
if (stdout && stdout !== '') {
gulp.src('./')
.pipe(git.add({
args: '--all'
}))
.pipe(git.commit('Stable dev version update.')).on('end',
function() {
git.push('origin', 'stable', { quiet: true },
function(err) {
if (err) {
throw err;
}
process.chdir(__dirname);
done();
});
});
} else {
console.log('No difference since last commit, ' +
'skipping stable release.');
process.chdir(__dirname);
done();
}
});
});
});
}
);
} else {
console.warn('Skipping release. Release:stable task should be ' +
'executed by CI only.');
}
});
grommetToolbox(gulp);
gulp.task('dev', function () {
console.error('Running "gulp dev" here is not supported. ' +
'Please use "gulp dist".');
});