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

set -xeo pipefail

environment=$1

if [ "$environment" == "production" ]; then
  export REPLICAS=2
  export INGRESS_HOSTNAME=next-docs.expo.io
  export ENVIRONMENT=production
elif [ "$environment" == "staging" ]; then
  export REPLICAS=1
  export INGRESS_HOSTNAME=staging.next-docs.expo.io
  export ENVIRONMENT=staging
else
  echo "Unrecognized environment $environment"
  exit 1
fi

export TAG=$2

echo "Checking for image..."

if ! gcloud container images describe "gcr.io/exponentjs/exponent-docs-v2:$TAG"; then
  echo "Unable to find image tagged with $TAG"
  exit 2
fi

echo "Environment set, found image, deploying..."

envsubst < ./docs.k8s.template.yml | kubectl apply -f -<commit_msg>[docs] deploy staging to staging.docs.expo.io<commit_after>#!/usr/bin/env bash

set -xeo pipefail

environment=$1

if [ "$environment" == "production" ]; then
  export REPLICAS=2
  export INGRESS_HOSTNAME=next-docs.expo.io
  export ENVIRONMENT=production
elif [ "$environment" == "staging" ]; then
  export REPLICAS=1
  export INGRESS_HOSTNAME=staging.docs.expo.io
  export ENVIRONMENT=staging
else
  echo "Unrecognized environment $environment"
  exit 1
fi

export TAG=$2

echo "Checking for image..."

if ! gcloud container images describe "gcr.io/exponentjs/exponent-docs-v2:$TAG"; then
  echo "Unable to find image tagged with $TAG"
  exit 2
fi

echo "Environment set, found image, deploying..."

envsubst < ./docs.k8s.template.yml | kubectl apply -f -
{'fraction_non_alphanumeric': 0.11582491582491583, 'fraction_numerical': 0.010774410774410775, 'mean_word_length': 4.364620938628159, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3774142', 'n_tokens_mistral': 538, 'n_tokens_neox': 514, 'n_words': 142}