2014-10-04 02:26:05 +02:00
|
|
|
module.exports = function (grunt) {
|
2015-08-15 01:20:48 +02:00
|
|
|
var readline = require('readline');
|
|
|
|
|
2014-10-04 02:26:05 +02:00
|
|
|
// build, then zip and upload to s3
|
|
|
|
grunt.registerTask('release', [
|
2015-08-15 01:20:48 +02:00
|
|
|
'_release:confirmUpload',
|
|
|
|
'_release:loadS3Config',
|
2014-10-04 02:26:05 +02:00
|
|
|
'build',
|
|
|
|
's3:release',
|
2015-08-15 01:20:48 +02:00
|
|
|
'_release:complete'
|
2014-10-04 02:26:05 +02:00
|
|
|
]);
|
|
|
|
|
2015-08-15 01:20:48 +02:00
|
|
|
grunt.registerTask('_release:confirmUpload', function () {
|
|
|
|
var rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
});
|
|
|
|
|
|
|
|
rl.on('close', this.async());
|
|
|
|
rl.question('Do you want to actually upload the files to s3 after building?, [N/y] ', function (resp) {
|
|
|
|
var debug = resp.toLowerCase().trim()[0] !== 'y';
|
|
|
|
grunt.config.set('s3.release.debug', debug);
|
|
|
|
rl.close();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-10-04 02:26:05 +02:00
|
|
|
// collect the key and secret from the .aws-config.json file, finish configuring the s3 task
|
2015-08-15 01:20:48 +02:00
|
|
|
grunt.registerTask('_release:loadS3Config', function () {
|
2014-10-04 02:26:05 +02:00
|
|
|
var config = grunt.file.readJSON('.aws-config.json');
|
|
|
|
grunt.config('s3.options', {
|
|
|
|
key: config.key,
|
|
|
|
secret: config.secret
|
|
|
|
});
|
|
|
|
});
|
2015-08-14 20:53:26 +02:00
|
|
|
|
2015-08-15 01:20:48 +02:00
|
|
|
grunt.registerTask('_release:complete', function () {
|
2015-08-14 20:53:26 +02:00
|
|
|
grunt.log.ok('Builds released');
|
|
|
|
grunt.log.write(
|
|
|
|
`
|
|
|
|
${grunt.config.get('platforms').reduce((t, p) => {
|
|
|
|
return (
|
|
|
|
`${t}https://download.elastic.co/kibana/kibana/${p.buildName}.tar.gz
|
|
|
|
https://download.elastic.co/kibana/kibana/${p.buildName}.zip
|
|
|
|
`
|
|
|
|
);
|
|
|
|
}, '')}
|
|
|
|
`
|
|
|
|
);
|
|
|
|
});
|
2015-08-01 01:33:01 +02:00
|
|
|
};
|