Update deploy script for use in CircleCI

This commit is contained in:
Andrew Miner
2015-04-28 10:22:18 -07:00
parent c528fc4eab
commit 2fc8ab4f16
+14 -10
View File
@@ -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"