From aa78a45e1362cf0c0c5c696c183dfa497ef57fed Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 8 Jan 2016 15:42:05 +0100 Subject: [PATCH] prepare beta deployment task --- README.md | 15 ++++++++++++++- gulpfile.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 654b05f..9575f33 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > Landing page for www.bigchain.io -[Live](http://www.bigchain.io) | [Styleguide](http://www.bigchain.io/styleguide/) +[Live](https://www.bigchain.io) | [Beta](https://beta.bigchain.io) | [Styleguide](https://www.bigchain.io/styleguide/) ## Development @@ -52,6 +52,19 @@ AWS_PROFILE=bigchain gulp deploy:live In case that you get authentication errors or need an alternative way to authenticate with AWS, check out the [AWS documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html). +### Production build & beta deployment + +```bash +# make sure your local npm packages & gems are up to date +npm update && bundle update + +# make production build in /_dist +gulp build --production + +# deploy contents of /_dist to beta +gulp deploy:beta +``` + ### Production build & live deployment ```bash diff --git a/gulpfile.js b/gulpfile.js index a859d82..de5d01b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -358,3 +358,51 @@ gulp.task('deploy:live', function() { states: ['create', 'update', 'delete'] })); }); + +gulp.task('deploy:beta', function() { + + // create publisher, define config + var publisher = $.awspublish.create({ + params: { + 'Bucket': S3BUCKET_BETA + }, + 'accessKeyId': process.env.AWS_ACCESS_KEY, + 'secretAccessKey': process.env.AWS_SECRET_KEY, + 'region': S3REGION_BETA + }); + + return gulp.src(DIST + '**/*') + .pipe($.awspublishRouter({ + cache: { + // cache for 5 minutes by default + cacheTime: 300 + }, + routes: { + // all static assets, cached & gzipped + '^assets/(?:.+)\\.(?:js|css|png|jpg|jpeg|gif|ico|svg|ttf)$': { + cacheTime: 2592000, // cache for 1 month + gzip: true + }, + + // every other asset, cached + '^assets/.+$': { + cacheTime: 2592000 // cache for 1 month + }, + + // all html files, not cached & gzipped + '^.+\\.html': { + cacheTime: 0, + gzip: true + }, + + // pass-through for anything that wasn't matched by routes above, to be uploaded with default options + "^.+$": "$&" + } + })) + .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'] + })); +});