Files
data/scripts/deploy
T

34 lines
771 B
Bash
Executable File

#!/bin/bash
if [[ -e "./aws.config" ]]; then
export AWS_CONFIG_FILE="./aws.config"
else
export AWS_CONFIG_FILE="~/.aws/config"
fi
SOURCE_DIR="./data/"
SITE="crafting-guide.com"
TARGET=""
while [[ "$1" != "" ]]; do
case "$1" in
"--staging") TARGET="staging";;
"--production") TARGET="production";;
esac
shift
done
if [[ "$TARGET" == "" ]]; then
echo "Please choose either --staging or --production for the target."
exit 1
fi
if [[ "$TARGET" == "staging" ]]; then
TARGET_DIR="s3://new.$SITE/data/"
elif [[ "$TARGET" == "production" ]]; then
TARGET_DIR="s3://$SITE/data/"
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"