<commit_before><commit_msg>Attempt to checkout and deploy the latest release to GitHub<commit_after>#!/bin/bash
set -ex

git config --global user.email "<EMAIL>"
git config --global user.name "<NAME>"

# Update the latest-release branch with the most recent tagged release

# we want this to only happen from our repo, not forks
# check this is not a pull request
# check we're on the master branch

if [ "$TRAVIS_REPO_SLUG" == "alphagov/govuk_prototype_kit" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
  # get the version from the version file
  VERSION_TAG="$(cat VERSION.txt)"
  # check to make sure the tag exists
  if git rev-parse "$VERSION_TAG" >/dev/null 2>&1; then
    echo "Checking the most recent tag: $VERSION_TAG and creating a latest-release branch"
    git remote add deploy-latest-release https://${GH_TOKEN}@github.com/alphagov/govuk_prototype_kit.git > /dev/null 2>&1
    git checkout tags/"$VERSION_TAG" -b latest-release
    git push -f deploy-latest-release latest-release
    echo "Pushed latest-release branch to GitHub"
  fi
else
  echo "Not updating the latest-release branch as we're on a branch..."
fi
{'fraction_non_alphanumeric': 0.10854700854700855, 'fraction_numerical': 0.003418803418803419, 'mean_word_length': 4.135964912280702, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 1, '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': '1428077', 'n_tokens_mistral': 372, 'n_tokens_neox': 358, 'n_words': 136}