mirror of
https://github.com/bigchaindb/site.git
synced 2024-12-24 18:36:11 +01:00
Travis setup (#72)
* change beta deployment behavior: on every pull request instead of named branch * consolidate gulp deploy tasks into one * push 100 objects in parallel to S3 * make CI scripts a bit more verbose
This commit is contained in:
parent
5947326c3f
commit
72fff1dbca
28
.travis.yml
Normal file
28
.travis.yml
Normal file
@ -0,0 +1,28 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.3.0
|
||||
|
||||
cache:
|
||||
bundler: true
|
||||
directories:
|
||||
- $TRAVIS_BUILD_DIR/node_modules
|
||||
|
||||
before_install:
|
||||
- nvm install 6
|
||||
|
||||
before_script: "_ci/setup.sh"
|
||||
script: "_ci/build.sh"
|
||||
after_success: "_ci/deploy.sh"
|
||||
|
||||
# deploy:
|
||||
# skip_cleanup: true
|
||||
# provider: script
|
||||
# script: "_ci/deploy.sh"
|
||||
# on:
|
||||
# all_branches: true
|
||||
|
||||
notifications:
|
||||
email: false
|
10
README.md
10
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
> Landing page for BigchainDB
|
||||
|
||||
[ ![Codeship Status for ascribe/bigchain-website](https://codeship.com/projects/3204bb70-c384-0133-9cd7-5a80e4317151/status?branch=master)](https://codeship.com/projects/138094)
|
||||
[![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](https://beta.bigchaindb.com) | [Styleguide](https://www.bigchaindb.com/styleguide/)
|
||||
|
||||
@ -32,11 +32,11 @@ gulp
|
||||
|
||||
## Continuous Delivery
|
||||
|
||||
The site gets built & deployed automatically via Codeship under the following conditions:
|
||||
The site gets built & deployed automatically via Travis under the following conditions:
|
||||
|
||||
- every push builds the site
|
||||
- every push to the master branch initiates a live deployment
|
||||
- every push to a branch starting with `feature` initiates a beta deployment
|
||||
- every pull request initiates a beta deployment
|
||||
|
||||
## Manual Deployment
|
||||
|
||||
@ -72,7 +72,7 @@ npm update && bundle update
|
||||
gulp build --production
|
||||
|
||||
# deploy contents of /_dist to beta
|
||||
gulp deploy:beta
|
||||
gulp deploy --beta
|
||||
```
|
||||
|
||||
### Production build & live deployment
|
||||
@ -85,5 +85,5 @@ npm update && bundle update
|
||||
gulp build --production
|
||||
|
||||
# deploy contents of /_dist to live
|
||||
gulp deploy:live
|
||||
gulp deploy --live
|
||||
```
|
||||
|
14
_ci/build.sh
14
_ci/build.sh
@ -2,6 +2,16 @@
|
||||
|
||||
set -e;
|
||||
|
||||
gulp build --production
|
||||
echo "$(tput setaf 136)"
|
||||
echo "============================================="
|
||||
echo " Starting build "
|
||||
echo "============================================="
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
||||
exit;
|
||||
gulp build --production
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ done building"
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
@ -2,10 +2,35 @@
|
||||
|
||||
set -e;
|
||||
|
||||
if [ $CI_BRANCH == "master" ]; then
|
||||
gulp deploy:live
|
||||
##
|
||||
## check for pull request against master
|
||||
##
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||
|
||||
gulp deploy --beta;
|
||||
|
||||
|
||||
##
|
||||
## check for master push which is no pull request
|
||||
##
|
||||
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
|
||||
gulp deploy --live;
|
||||
|
||||
else
|
||||
gulp deploy:beta
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ nothing to deploy "
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
||||
fi;
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ done deployment "
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
||||
exit;
|
||||
|
14
_ci/setup.sh
14
_ci/setup.sh
@ -2,8 +2,18 @@
|
||||
|
||||
set -e;
|
||||
|
||||
echo "$(tput setaf 136)"
|
||||
echo " Installing dependencies "
|
||||
echo "============================================="
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
||||
npm install gulp -g
|
||||
npm install
|
||||
bundle install
|
||||
|
||||
exit;
|
||||
# Travis does that automatically after selecting ruby
|
||||
#bundle install
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo " ✓ done installing dependencies"
|
||||
echo "$(tput sgr0)" # reset
|
||||
|
109
gulpfile.js
109
gulpfile.js
@ -319,17 +319,37 @@ gulp.task('build', function(done) {
|
||||
// Deployment
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
gulp.task('deploy:live', function() {
|
||||
//
|
||||
// gulp deploy --live
|
||||
// gulp deploy --beta
|
||||
//
|
||||
gulp.task('deploy', function() {
|
||||
|
||||
// create publisher, define config
|
||||
var publisher = $.awspublish.create({
|
||||
params: {
|
||||
'Bucket': S3BUCKET
|
||||
},
|
||||
'accessKeyId': process.env.AWS_ACCESS_KEY,
|
||||
'secretAccessKey': process.env.AWS_SECRET_KEY,
|
||||
'region': S3REGION
|
||||
});
|
||||
if ($.util.env.live === true) {
|
||||
var publisher = $.awspublish.create({
|
||||
params: { "Bucket": S3BUCKET },
|
||||
"accessKeyId": process.env.AWS_ACCESS_KEY,
|
||||
"secretAccessKey": process.env.AWS_SECRET_KEY,
|
||||
"region": S3REGION
|
||||
});
|
||||
|
||||
$.util.log($.util.colors.gray(" ------------------------------------------"));
|
||||
$.util.log($.util.colors.green(' Deploying to Live... '));
|
||||
$.util.log($.util.colors.gray(" ------------------------------------------"));
|
||||
}
|
||||
if ($.util.env.beta === true) {
|
||||
var publisher = $.awspublish.create({
|
||||
params: { "Bucket": S3BUCKET_BETA },
|
||||
"accessKeyId": process.env.AWS_BETA_ACCESS_KEY,
|
||||
"secretAccessKey": process.env.AWS_BETA_SECRET_KEY,
|
||||
"region": S3REGION_BETA
|
||||
});
|
||||
|
||||
$.util.log($.util.colors.gray(" ------------------------------------------"));
|
||||
$.util.log($.util.colors.green(' Deploying to Beta... '));
|
||||
$.util.log($.util.colors.gray(" ------------------------------------------"));
|
||||
}
|
||||
|
||||
return gulp.src(DIST + '**/*')
|
||||
.pipe($.awspublishRouter({
|
||||
@ -339,7 +359,7 @@ gulp.task('deploy:live', function() {
|
||||
},
|
||||
routes: {
|
||||
// all static assets, cached & gzipped
|
||||
'^assets/(?:.+)\\.(?:js|css|png|jpg|jpeg|gif|ico|svg|ttf|eot|woff|woff2)$': {
|
||||
'^assets/(?:.+)\\.(?:js|css|png|jpg|jpeg|gif|ico|svg|ttf)$': {
|
||||
cacheTime: 2592000, // cache for 1 month
|
||||
gzip: true
|
||||
},
|
||||
@ -377,75 +397,8 @@ gulp.task('deploy:live', function() {
|
||||
"^.+$": "$&"
|
||||
}
|
||||
}))
|
||||
.pipe(parallelize(publisher.publish(), 10))
|
||||
.pipe(parallelize(publisher.publish(), 100))
|
||||
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
|
||||
.pipe(publisher.cache())
|
||||
.pipe($.awspublish.reporter({
|
||||
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|eot|woff|woff2)$': {
|
||||
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
|
||||
},
|
||||
|
||||
// font mime types
|
||||
'\.eot$': {
|
||||
key: '$&',
|
||||
headers: { 'Content-Type': 'application/vnd.ms-fontobject' }
|
||||
},
|
||||
'\.ttf$': {
|
||||
key: '$&',
|
||||
headers: { 'Content-Type': 'application/x-font-ttf' }
|
||||
},
|
||||
'\.woff$': {
|
||||
key: '$&',
|
||||
headers: { 'Content-Type': 'application/x-font-woff' }
|
||||
},
|
||||
'\.woff2$': {
|
||||
key: '$&',
|
||||
headers: { 'Content-Type': 'application/x-font-woff2' }
|
||||
},
|
||||
|
||||
// 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']
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user