Created
July 28, 2015 08:08
-
-
Save jalada/30955ce7469d728eae0a to your computer and use it in GitHub Desktop.
Gulp task for deploying dist/ to S3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public: Deploy to AWS. | |
gulp.task('deploy', function() { | |
var publisher = $.awspublish.create({ | |
params: { | |
Bucket: 'my-bucket' | |
}, | |
// Put credentials in .env, use dotenv | |
region: 'eu-west-1' | |
}); | |
// TODO: Cache headers? | |
return gulp.src('./dist/**/*') | |
.pipe($.plumber()) | |
// gzip, Set Content-Encoding headers | |
.pipe($.awspublish.gzip({})) | |
// Do the publishing. | |
.pipe(publisher.publish({})) | |
// Delete any files not present locally. | |
.pipe(publisher.sync()) | |
// create a cache file to speed up consecutive uploads | |
.pipe(publisher.cache()) | |
// print upload updates to console | |
.pipe($.awspublish.reporter()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment