mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 01:36:55 +01:00
rewrite deploy script to use awscli
This commit is contained in:
parent
27852f907d
commit
59c5e7b7be
@ -1,14 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Required global environment variables:
|
||||
#
|
||||
# AWS_ACCESS_KEY_ID
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
# AWS_DEFAULT_REGION
|
||||
#
|
||||
|
||||
set -e;
|
||||
|
||||
SOURCE="./_dist"
|
||||
BUCKET_LIVE="www.bigchaindb.com"
|
||||
BUCKET_BETA="beta.bigchaindb.com"
|
||||
OPTIONS_DEFAULT="--delete --acl public-read"
|
||||
OPTIONS_CACHING="--cache-control max-age=2592000,public"
|
||||
|
||||
##
|
||||
## check for pull request against master
|
||||
##
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||
|
||||
#gulp deploy --beta;
|
||||
aws s3 sync ./_dist s3://beta.bigchaindb.com --delete --acl public-read --sse
|
||||
|
||||
echo "$(tput setaf 64)---------------------------------------------"
|
||||
echo " Deploying to Beta "
|
||||
echo "---------------------------------------------$(tput sgr0)"
|
||||
|
||||
aws s3 sync $SOURCE s3://$BUCKET_BETA --exclude "assets/*" $OPTIONS_DEFAULT
|
||||
aws s3 sync $SOURCE s3://$BUCKET_BETA --exclude "*" --include "assets/*" $OPTIONS_DEFAULT $OPTIONS_CACHING
|
||||
|
||||
|
||||
##
|
||||
@ -17,22 +36,26 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; th
|
||||
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
|
||||
#gulp deploy --live;
|
||||
aws s3 sync ./_dist s3://www.bigchaindb.com --delete --acl public-read --sse
|
||||
|
||||
echo "$(tput setaf 64)---------------------------------------------"
|
||||
echo " Deploying to Live "
|
||||
echo "---------------------------------------------$(tput sgr0)"
|
||||
|
||||
aws s3 sync $SOURCE s3://$BUCKET_LIVE --exclude "assets/*" $OPTIONS_DEFAULT
|
||||
aws s3 sync $SOURCE s3://$BUCKET_LIVE --exclude "*" --include "assets/*" $OPTIONS_DEFAULT $OPTIONS_CACHING
|
||||
|
||||
gulp seo --live
|
||||
|
||||
else
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput setaf 64)---------------------------------------------"
|
||||
echo " ✓ nothing to deploy "
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput sgr0)" # reset
|
||||
echo "---------------------------------------------$(tput sgr0)"
|
||||
|
||||
fi;
|
||||
|
||||
echo "$(tput setaf 64)" # green
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput setaf 64)---------------------------------------------"
|
||||
echo " ✓ done deployment "
|
||||
echo "---------------------------------------------"
|
||||
echo "$(tput sgr0)" # reset
|
||||
echo "---------------------------------------------$(tput sgr0)"
|
||||
|
||||
exit;
|
||||
|
@ -57,15 +57,12 @@ const PORT = 1337
|
||||
|
||||
// paths
|
||||
const SRC = site.source,
|
||||
DIST = '_dist'
|
||||
DIST = site.destination
|
||||
|
||||
// deployment
|
||||
const S3BUCKET = 'www.bigchaindb.com',
|
||||
S3REGION = 'eu-central-1',
|
||||
S3BUCKET_BETA = 'beta.bigchaindb.com',
|
||||
S3REGION_BETA = 'eu-central-1',
|
||||
S3BUCKET_GAMMA = 'gamma.bigchaindb.com',
|
||||
S3REGION_GAMMA = 'eu-central-1'
|
||||
S3BUCKET_GAMMA = 'gamma.bigchaindb.com'
|
||||
|
||||
// SVG sprite
|
||||
const SPRITECONFIG = {
|
||||
@ -370,23 +367,23 @@ export const s3 = () => {
|
||||
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
|
||||
'accessKeyId': process.env.AWS_ACCESS_KEY_ID,
|
||||
'secretAccessKey': process.env.AWS_SECRET_ACCESS_KEY,
|
||||
'region': process.env.AWS_DEFAULT_REGION
|
||||
})
|
||||
} else 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
|
||||
'accessKeyId': process.env.AWS_ACCESS_KEY_ID,
|
||||
'secretAccessKey': process.env.AWS_SECRET_ACCESS_KEY,
|
||||
'region': process.env.AWS_DEFAULT_REGION
|
||||
})
|
||||
} else if ($.util.env.gamma === true) {
|
||||
var publisher = $.awspublish.create({
|
||||
params: { 'Bucket': S3BUCKET_GAMMA },
|
||||
'accessKeyId': process.env.AWS_GAMMA_ACCESS_KEY,
|
||||
'secretAccessKey': process.env.AWS_GAMMA_SECRET_KEY,
|
||||
'region': S3REGION_GAMMA
|
||||
'accessKeyId': process.env.AWS_ACCESS_KEY_ID,
|
||||
'secretAccessKey': process.env.AWS_SECRET_ACCESS_KEY,
|
||||
'region': process.env.AWS_DEFAULT_REGION
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user