Update deploy script for use in CircleCI
This commit is contained in:
+14
-10
@@ -1,8 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export AWS_CONFIG_FILE="aws.config"
|
if [[ -e "./aws.config" ]]; then
|
||||||
|
export AWS_CONFIG_FILE="./aws.config"
|
||||||
|
else
|
||||||
|
export AWS_CONFIG_FILE="~/.aws/config"
|
||||||
|
fi
|
||||||
|
|
||||||
ROOT="./data"
|
SOURCE_DIR="./data/"
|
||||||
SITE="crafting-guide.com"
|
SITE="crafting-guide.com"
|
||||||
TARGET=""
|
TARGET=""
|
||||||
while [[ "$1" != "" ]]; do
|
while [[ "$1" != "" ]]; do
|
||||||
@@ -15,15 +19,15 @@ done
|
|||||||
|
|
||||||
if [[ "$TARGET" == "" ]]; then
|
if [[ "$TARGET" == "" ]]; then
|
||||||
echo "Please choose either --staging or --production for the target."
|
echo "Please choose either --staging or --production for the target."
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$TARGET" == "staging" ]]; then
|
if [[ "$TARGET" == "staging" ]]; then
|
||||||
find "$ROOT" -name ".DS_Store" 2>/dev/null | xargs rm &>/dev/null
|
TARGET_DIR="s3://new.$SITE/data/"
|
||||||
if grunt test; then
|
elif [[ "$TARGET" == "production" ]]; then
|
||||||
echo "Preparing to upload to S3..."
|
TARGET_DIR="s3://$SITE/data/"
|
||||||
s3cmd sync -r --add-header="cache-control:max-age=1800" "$ROOT/" "s3://new.$SITE/data/"
|
|
||||||
fi
|
|
||||||
elif [[ "$TARGET" == "promote" ]]; then
|
|
||||||
aws s3 sync "s3://new.$SITE" "s3://$SITE" --delete
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Preparing to upload to S3..."
|
||||||
|
s3cmd sync -r --add-header="cache-control:max-age=1800" $SOURCE_DIR $TARGET_DIR
|
||||||
|
echo "S3 Upload Complete"
|
||||||
|
|||||||
Reference in New Issue
Block a user