switch to rsync deployment

This commit is contained in:
Matthias Kretschmann 2016-04-15 23:57:47 +02:00
parent 843d984b09
commit b28c3e8606
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
2 changed files with 12 additions and 34 deletions

View File

@ -19,9 +19,7 @@ var onError = function(error) {
} }
var src = 'src/', var src = 'src/',
dist = 'dist/', dist = 'dist/';
s3bucket = 'kretschmann.io',
s3region = 'eu-west-1';
// //
// clean everything // clean everything
@ -127,26 +125,17 @@ gulp.task('watch', function () {
// //
// S3 Deployment // rsync Deployment
// //
gulp.task('s3', function() { gulp.task('deploy', function() {
return gulp.src(dist)
var publisher = $.awspublish.create({ .pipe($.rsync({
params: { 'Bucket': s3bucket }, 'region': s3region root: dist,
}); hostname: 'kretschmann',
destination: '/var/www/kretschmann.io/html',
// define custom headers recursive: true,
var headers = { clean: true
'Cache-Control': 'max-age=315360000, no-transform, public', }));
'x-amz-acl': 'public-read'
};
return gulp.src(dist + '**/*')
.pipe($.awspublish.gzip({ ext: '' })) // gzip all the things
.pipe(parallelize(publisher.publish(), 10))
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
.pipe(publisher.cache())
.pipe($.awspublish.reporter({ states: ['create', 'update', 'delete'] }));
}); });
@ -174,15 +163,3 @@ gulp.task('build', function (callback) {
callback callback
); );
}); });
//
// gulp deploy: Deployment with fresh production build
//
gulp.task('deploy', function (callback) {
runSequence(
'build',
's3',
callback
);
});

View File

@ -18,6 +18,7 @@
"gulp-rename": ">=1.2.2", "gulp-rename": ">=1.2.2",
"gulp-rev": ">=4.0.0", "gulp-rev": ">=4.0.0",
"gulp-rev-replace": ">=0.4.1", "gulp-rev-replace": ">=0.4.1",
"gulp-rsync": "0.0.5",
"run-sequence": ">=1.1.0" "run-sequence": ">=1.1.0"
}, },
"scripts": { "scripts": {