From eba08159de711b3b7feebcba5d55f4fe0d31a12f Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 13 Sep 2015 21:40:06 +0200 Subject: [PATCH] deploy task --- gulpfile.js | 34 +++++++++++++++++++++++++++++++++- package.json | 5 +++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 860fca0..90c5dc7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,7 +21,10 @@ var onError = function(error) { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ var src = 'src/', - dist = 'dist/'; + dist = 'dist/', + s3bucket = 'lab.kremalicious.com', + s3path = '/appstorebadges/', + s3region = 'eu-central-1'; // code banner @@ -112,3 +115,32 @@ gulp.task('default', ['css', 'html', 'watch', 'connect']); // Full build // gulp.task('build', ['css', 'html']); + + +// +// Deploy to S3 +// +gulp.task('deploy', function() { + var publisher = $.awspublish.create({ + params: { + 'Bucket': s3bucket + }, + 'region': s3region + }); + + // define custom headers + var headers = { + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'x-amz-acl': 'public-read' + }; + + return gulp.src(dist + '*') + .pipe($.rename(function (path) { + path.dirname += s3path; + })) + .pipe($.awspublish.gzip({ ext: '' })) // gzip all the things + .pipe(publisher.publish(headers)) + .pipe($.awspublish.reporter({ + states: ['create', 'update', 'delete'] + })); +}); diff --git a/package.json b/package.json index 7689025..72d3e18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appstorebadges", - "version": "1.0.0", + "version": "0.0.9", "author": { "name": "Matthias Kretschmann", "email": "m@kretschmann.io" @@ -17,13 +17,14 @@ "gulp": ">=3.8.0", "gulp-assemble": ">=0.3.2", "gulp-autoprefixer": ">=2.3.0", + "gulp-awspublish": ">=3.0.0", "gulp-connect": ">=2.0.5", "gulp-cssmin": ">=0.1.7", "gulp-extname": ">=0.2.0", "gulp-header": "^1.7.1", "gulp-htmlmin": ">=1.1.4", "gulp-load-plugins": ">=0.10.0", - "gulp-rename": "^1.2.2", + "gulp-rename": ">=1.2.2", "gulp-stylus": ">=2.0.6", "gulp-util": ">=3.0.6", "normalize.css": "^3.0.3"