Skip to content

Instantly share code, notes, and snippets.

@jalada
Created July 28, 2015 08:08
Show Gist options
  • Save jalada/30955ce7469d728eae0a to your computer and use it in GitHub Desktop.
Save jalada/30955ce7469d728eae0a to your computer and use it in GitHub Desktop.
Gulp task for deploying dist/ to S3
// 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