1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 09:46:57 +01:00

prevent search engine indexing of beta & gamma

- next strategy, cause 8103c6884e didn't work
This commit is contained in:
Matthias Kretschmann 2017-03-20 16:16:03 +01:00
parent 7eda6abf14
commit 624cd25702
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
3 changed files with 45 additions and 16 deletions

View File

@ -4,7 +4,7 @@
[![Build Status](https://travis-ci.com/ascribe/bigchain-website.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=master)](https://travis-ci.com/ascribe/bigchain-website) [![Build Status](https://travis-ci.com/ascribe/bigchain-website.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=master)](https://travis-ci.com/ascribe/bigchain-website)
[Live](https://www.bigchaindb.com) | [Beta](http://beta.bigchaindb.com) | [Gamma](http://gamma.bigchaindb.com) | [Styleguide](https://www.bigchaindb.com/styleguide/) [Live](https://www.bigchaindb.com) | [Styleguide](https://www.bigchaindb.com/styleguide/) | [Beta](http://beta.bigchaindb.com) | [Gamma](http://gamma.bigchaindb.com)
## Development ## Development
@ -69,14 +69,16 @@ 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). 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 ### Staging build & beta deployment
The staging build is essentially a full production build but it prevents search engine indexing & Google Analytics tracking.
```bash ```bash
# make sure your local npm packages & gems are up to date # make sure your local npm packages & gems are up to date
npm update && bundle update npm update && bundle update
# make production build in /_dist # make staging build in /_dist
gulp build --production gulp build --staging
# deploy contents of /_dist to beta # deploy contents of /_dist to beta
gulp deploy --beta gulp deploy --beta
@ -85,6 +87,9 @@ gulp deploy --beta
There's also a second beta deployment target called gamma under http://gamma.bigchaindb.com: There's also a second beta deployment target called gamma under http://gamma.bigchaindb.com:
```bash ```bash
# build preventing search engine indexing & Google Analytics tracking
gulp build --staging
# deploy contents of /_dist to gamma # deploy contents of /_dist to gamma
gulp deploy --gamma gulp deploy --gamma
``` ```

View File

@ -8,8 +8,28 @@ echo " Starting build "
echo "=============================================" echo "============================================="
echo "$(tput sgr0)" # reset echo "$(tput sgr0)" # reset
##
## check for pull request against master
##
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
gulp build --staging
##
## check for master push which is no pull request
##
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
gulp build --production gulp build --production
else
gulp build --production
fi;
echo "$(tput setaf 64)" # green echo "$(tput setaf 64)" # green
echo "---------------------------------------------" echo "---------------------------------------------"
echo " ✓ done building" echo " ✓ done building"

View File

@ -25,7 +25,8 @@ var onError = function(error) {
// 'development' is just default, production overrides are triggered // 'development' is just default, production overrides are triggered
// by adding the production flag to the gulp command e.g. `gulp build --production` // by adding the production flag to the gulp command e.g. `gulp build --production`
var isProduction = ($.util.env.production === true ? true : false); var isProduction = ($.util.env.production === true ? true : false),
isStaging = ($.util.env.staging === true ? true : false);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -116,6 +117,9 @@ gulp.task('jekyll', function(cb) {
if (isProduction) { if (isProduction) {
process.env.JEKYLL_ENV = 'production'; process.env.JEKYLL_ENV = 'production';
var jekyll_options = 'jekyll build'; var jekyll_options = 'jekyll build';
} else if (isStaging) {
process.env.JEKYLL_ENV = 'staging';
var jekyll_options = 'jekyll build';
} else { } else {
process.env.JEKYLL_ENV = 'development'; process.env.JEKYLL_ENV = 'development';
var jekyll_options = 'jekyll build --incremental --drafts --future'; var jekyll_options = 'jekyll build --incremental --drafts --future';
@ -134,7 +138,7 @@ gulp.task('jekyll', function(cb) {
// //
gulp.task('html', function() { gulp.task('html', function() {
return gulp.src(DIST + '/**/*.html') return gulp.src(DIST + '/**/*.html')
.pipe($.if(isProduction, $.htmlmin({ .pipe($.if(isProduction || isStaging, $.htmlmin({
collapseWhitespace: true, collapseWhitespace: true,
conservativeCollapse: true, conservativeCollapse: true,
removeComments: true, removeComments: true,
@ -157,9 +161,9 @@ gulp.task('css', function() {
.pipe($.sourcemaps.init()) .pipe($.sourcemaps.init())
.pipe($.sass().on('error', $.sass.logError)) .pipe($.sass().on('error', $.sass.logError))
.pipe($.autoprefixer({ browsers: COMPATIBILITY })) .pipe($.autoprefixer({ browsers: COMPATIBILITY }))
.pipe($.if(isProduction, $.cssmin())) .pipe($.if(isProduction || isStaging, $.cssmin()))
.pipe($.if(!isProduction, $.sourcemaps.write())) .pipe($.if(!isProduction, $.sourcemaps.write()))
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg }))) .pipe($.if(isProduction || isStaging, $.header(BANNER, { pkg: pkg })))
.pipe($.rename({ suffix: '.min' })) .pipe($.rename({ suffix: '.min' }))
.pipe(gulp.dest(DIST + 'assets/css/')) .pipe(gulp.dest(DIST + 'assets/css/'))
.pipe(browser.stream()); .pipe(browser.stream());
@ -176,9 +180,9 @@ gulp.task('js', function() {
]) ])
.pipe($.sourcemaps.init()) .pipe($.sourcemaps.init())
.pipe($.include()) .pipe($.include())
.pipe($.if(isProduction, $.uglify())).on('error', onError) .pipe($.if(isProduction || isStaging, $.uglify())).on('error', onError)
.pipe($.if(!isProduction, $.sourcemaps.write())) .pipe($.if(!isProduction || !isStaging, $.sourcemaps.write()))
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg }))) .pipe($.if(isProduction || isStaging, $.header(BANNER, { pkg: pkg })))
.pipe($.rename({suffix: '.min'})) .pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest(DIST + 'assets/js/')); .pipe(gulp.dest(DIST + 'assets/js/'));
}); });
@ -189,7 +193,7 @@ gulp.task('js', function() {
// //
gulp.task('svg', function() { gulp.task('svg', function() {
return gulp.src(SRC + '_assets/images/**/*.svg') return gulp.src(SRC + '_assets/images/**/*.svg')
.pipe($.if(isProduction, $.imagemin({ .pipe($.if(isProduction || isStaging, $.imagemin({
svgoPlugins: [{ svgoPlugins: [{
removeRasterImages: true removeRasterImages: true
}] }]
@ -204,7 +208,7 @@ gulp.task('svg', function() {
// //
gulp.task('images', function() { gulp.task('images', function() {
return gulp.src(SRC + '_assets/images/**/*') return gulp.src(SRC + '_assets/images/**/*')
.pipe($.if(isProduction, $.imagemin({ .pipe($.if(isProduction || isStaging, $.imagemin({
optimizationLevel: 3, // png optimizationLevel: 3, // png
progressive: true, // jpg progressive: true, // jpg
interlaced: true, // gif interlaced: true, // gif
@ -239,7 +243,7 @@ gulp.task('videos', function() {
// //
gulp.task('rev', function() { gulp.task('rev', function() {
// globbing is slow so do everything conditionally for faster dev build // globbing is slow so do everything conditionally for faster dev build
if (isProduction) { if (isProduction || isStaging) {
return gulp.src(DIST + '/assets/**/*.{css,js,png,jpg,jpeg,svg,eot,ttf,woff,woff2}') return gulp.src(DIST + '/assets/**/*.{css,js,png,jpg,jpeg,svg,eot,ttf,woff,woff2}')
.pipe($.rev()) .pipe($.rev())
.pipe(gulp.dest(DIST + '/assets/')) .pipe(gulp.dest(DIST + '/assets/'))
@ -256,7 +260,7 @@ gulp.task('rev', function() {
// //
gulp.task('rev:replace', function() { gulp.task('rev:replace', function() {
// globbing is slow so do everything conditionally for faster dev build // globbing is slow so do everything conditionally for faster dev build
if (isProduction) { if (isProduction || isStaging) {
var manifest = gulp.src(DIST + '/assets/rev-manifest.json'); var manifest = gulp.src(DIST + '/assets/rev-manifest.json');
return gulp.src(DIST + '/**/*.{html,xml,txt,json,css,js}') return gulp.src(DIST + '/**/*.{html,xml,txt,json,css,js}')
@ -326,7 +330,7 @@ gulp.task('default', ['build', 'server'], function() {
gulp.task('build', function(done) { gulp.task('build', function(done) {
$.util.log($.util.colors.gray(" ------------------------------------------")); $.util.log($.util.colors.gray(" ------------------------------------------"));
$.util.log($.util.colors.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...')); $.util.log($.util.colors.green(' Building ' + ($.util.env.production ? 'production' : $.util.env.staging ? 'staging' : 'dev') + ' version...'));
$.util.log($.util.colors.gray(" ------------------------------------------")); $.util.log($.util.colors.gray(" ------------------------------------------"));
runSequence( runSequence(