<commit_before>#!/usr/bin/env bash

# Set global values
QUILL_CMS=https://cms.quill.org

# Set environment-specific values
case $1 in
  prod)
    # ENSURE THAT WE'RE ON MASTER FOR PRODUCTION DEPLOYS
    git checkout master
    git pull origin master
    EMPIRICAL_BASE_URL=https://www.quill.org
    LESSONS_WEBSOCKETS_URL=https://lessons-server.quill.org/
    NODE_ENV=prod
    S3_DEPLOY_BUCKET=s3://aws-website-quill-lessons
    ;;
  staging)
    EMPIRICAL_BASE_URL=https://staging.quill.org
    LESSONS_WEBSOCKETS_URL=https://staging-lessons-server.quill.org/
    NODE_ENV=staging
    S3_DEPLOY_BUCKET=s3://aws-website-quill-lessons-staging
    ;;
  *)
    echo "You must provide an environment argument of either 'staging' or 'prod'."
esac

# Remove any old builds we have lying around
if [[ -d ./dist ]]
then
  rm -rf ./dist
fi

# Execute a new build
npm run build

# Upload build to S3 bucket
aws s3 sync ./dist ${S3_DEPLOY_BUCKET} --profile peter-aws<commit_msg>Update code that checks current branch for prod deploys<commit_after>#!/usr/bin/env bash

# Set global values
QUILL_CMS=https://cms.quill.org

# Set environment-specific values
case $1 in
  prod)
    # ENSURE THAT WE'RE ON MASTER FOR PRODUCTION DEPLOYS
    current_branch=`git rev-parse --abbrev-ref HEAD`
    if [ "$current_branch" != "master" ]
    then
      echo "You can not make a production deploy from a branch other than 'master'.  Don't forget to make sure you have the latest code pulled."
      exit 1
    fi
    export EMPIRICAL_BASE_URL=https://www.quill.org
    export LESSONS_WEBSOCKETS_URL=https://lessons-server.quill.org/
    export NODE_ENV=prod
    S3_DEPLOY_BUCKET=s3://aws-website-quill-lessons
    ;;
  staging)
    export EMPIRICAL_BASE_URL=https://staging.quill.org
    export LESSONS_WEBSOCKETS_URL=https://staging-lessons-server.quill.org/
    export NODE_ENV=staging
    S3_DEPLOY_BUCKET=s3://aws-website-quill-lessons-staging
    ;;
  *)
    echo "You must provide an environment argument of either 'staging' or 'prod'."
esac

# Remove any old builds we have lying around
if [[ -d ./dist ]]
then
  rm -rf ./dist
fi

# Execute a new build
npm run build

# Upload build to S3 bucket
aws s3 sync ./dist ${S3_DEPLOY_BUCKET} --profile peter-aws
{'fraction_non_alphanumeric': 0.10147518998658918, 'fraction_numerical': 0.007599463567277604, 'mean_word_length': 3.4229249011857705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199216', 'n_tokens_mistral': 840, 'n_tokens_neox': 798, 'n_words': 212}