-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgulpfile.js
More file actions
82 lines (66 loc) · 1.71 KB
/
Copy pathgulpfile.js
File metadata and controls
82 lines (66 loc) · 1.71 KB
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
'use strict';
var path = require('path');
var fs = require('fs');
var gulp = require('gulp');
var argv = require('yargs').default('environment', 'stage').argv;
var $ = require('gulp-load-plugins')();
var merge = require('merge-stream');
var runSequence = require('run-sequence');
var SRC_NAME = 'Quirkbot-Windows-Drivers-Installer.exe';
var RELEASE_NAME = 'quirkbot-windows-drivers';
var PACKAGE = JSON.parse(fs.readFileSync('package.json'));
var VERSION_FILENAME = `${RELEASE_NAME}-${PACKAGE.version}.exe`;
var LATEST_FILENAME = `${RELEASE_NAME}-latest.exe`;
/**
* Cleans all the generated files
*/
gulp.task('clean', function () {
return gulp.src([
LATEST_FILENAME,
RELEASE_NAME + '-*.exe'
])
.pipe($.clean());
});
/**
* Generate the files that will be published
*/
gulp.task('build', function (cb) {
var exec = require('child_process').exec;
exec(
`cp ${SRC_NAME} ${LATEST_FILENAME} `+
`&& cp ${SRC_NAME} ${VERSION_FILENAME}`,
(error, stdout, stderr) => {
console.log(stderr)
cb();
}
);
});
/**
* Builds and publish to s3
*/
gulp.task('s3', ['build'], function () {
var aws = JSON.parse(fs.readFileSync(path.join('aws-config', `${argv.environment}.json`)));
return gulp.src([
LATEST_FILENAME,
VERSION_FILENAME
])
.pipe($.s3(aws, {
uploadPath: 'downloads/'
}));
});
/**
* Deploys the release. Asks for confirmation if deploying to production
*/
gulp.task('confirm-deploy', [], function () {
if(argv.environment == 'production'){
return gulp.src('')
.pipe($.prompt.confirm('You are about to deploy TO PRODUCTION! Are you sure you want to continue)'))
.pipe($.prompt.confirm('Really sure?!'))
}
});
gulp.task('deploy', function (cb) {
runSequence(
'confirm-deploy',
's3',
cb);
});