Browse Source

added release task to gruntfile

Rashid Khan 12 years ago
parent
commit
18ee2fabcf
1 changed files with 61 additions and 0 deletions
  1. 61 0
      Gruntfile.js

+ 61 - 0
Gruntfile.js

@@ -189,6 +189,42 @@ module.exports = function (grunt) {
             dest: '<%= pkg.name %>-latest'
           }
         ]
+      },
+      zip_release: {
+        options: {
+          archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip'
+        },
+        files : [
+          {
+            expand: true,
+            cwd: '<%= destDir %>',
+            src: ['**/*'],
+            dest: '<%= pkg.name %>-<%= pkg.version %>'
+          },
+          {
+            expand: true,
+            src: ['LICENSE.md', 'README.md'],
+            dest: '<%= pkg.name %>-<%= pkg.version %>'
+          }
+        ]
+      },
+      tgz_release: {
+        options: {
+          archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
+        },
+        files : [
+          {
+            expand: true,
+            cwd: '<%= destDir %>',
+            src: ['**/*'],
+            dest: '<%= pkg.name %>-<%= pkg.version %>'
+          },
+          {
+            expand: true,
+            src: ['LICENSE.md', 'README.md'],
+            dest: '<%= pkg.name %>-<%= pkg.version %>'
+          }
+        ]
       }
     },
     s3: {
@@ -206,6 +242,21 @@ module.exports = function (grunt) {
             dest: 'kibana/kibana/<%= pkg.name %>-latest.tar.gz',
           }
         ]
+      },
+      release: {
+        bucket: 'download.elasticsearch.org',
+        access: 'private',
+        // debug: true, // uncommment to prevent actual upload
+        upload: [
+          {
+            src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip',
+            dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.zip',
+          },
+          {
+            src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz',
+            dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.tar.gz',
+          }
+        ]
       }
     }
   };
@@ -306,6 +357,16 @@ module.exports = function (grunt) {
     'clean:temp'
   ]);
 
+  // build, then zip and upload to s3
+  grunt.registerTask('release', [
+    'distribute:load_s3_config',
+    'build',
+    'compress:zip_release',
+    'compress:tgz_release',
+    's3:release',
+    'clean:temp'
+  ]);
+
   // collect the key and secret from the .aws-config.json file, finish configuring the s3 task
   grunt.registerTask('distribute:load_s3_config', function () {
     var config = grunt.file.readJSON('.aws-config.json');