2016-04-22 23:21:59 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var gulp = require('gulp'),
|
|
|
|
awspublish = require('gulp-awspublish')
|
|
|
|
|
|
|
|
// paths
|
|
|
|
var DIST = './site/';
|
|
|
|
|
|
|
|
// deployment
|
|
|
|
var S3BUCKET = 'kretschmann.cat',
|
|
|
|
S3REGION = 'eu-central-1';
|
|
|
|
|
|
|
|
|
|
|
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
// Deployment
|
|
|
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
gulp.task('deploy', function() {
|
|
|
|
|
|
|
|
// create publisher, define config
|
|
|
|
var publisher = awspublish.create({
|
|
|
|
params: {
|
2020-06-02 00:49:57 +02:00
|
|
|
Bucket: S3BUCKET
|
2016-04-22 23:21:59 +02:00
|
|
|
},
|
2020-06-02 00:49:57 +02:00
|
|
|
region: S3REGION
|
2016-04-22 23:21:59 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// define custom headers
|
|
|
|
var headers = {
|
2020-06-02 00:49:57 +02:00
|
|
|
'Cache-Control': 'public,max-age=0,must-revalidate'
|
2016-04-22 23:21:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return gulp.src(DIST + '**/*')
|
|
|
|
.pipe(publisher.publish(headers))
|
|
|
|
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
|
|
|
|
.pipe(awspublish.reporter({
|
|
|
|
states: ['create', 'update', 'delete']
|
|
|
|
}));
|
|
|
|
});
|