<commit_before>#!/bin/bash

# Build the `master` branch, and deploy it to the `qh-pages` branch.

# This is adapted from
# <http://www.steveklabnik.com/automatically_update_github_pages_with_travis_example/>.

# If there's an error during any command, exit the script. If any
# unset environment variable is used, exit the script.
set -o errexit -o nounset

# We only proceed if this deployment was triggered by a commit to
# `master`.
test "$TRAVIS_PULL_REQUEST" == "false" || exit 0
test "$TRAVIS_BRANCH" == "master" || exit 0

# We're going to make a commit to the gh-pages branch that looks a lot
# like the current commit on `master`.
git config user.name "$(git log -1 --pretty=%an HEAD)"
git config user.email "$(git log -1 --pretty=%ae HEAD)"
message="$(git log -1 --pretty=%B HEAD)"

# Without changing the state of the working copy, we reset to the
# `gh-pages` branch on GitHub. If the branch doesn't exist, we proceed
# anyway (`|| true`); we'll end up creating the branch ourselves.
git remote add rocketnia-upstream \
  "https://$ROCKETNIA_GH_TOKEN@github.com/rocketnia/mise-en.cene.git"
git fetch -q rocketnia-upstream
git reset rocketnia-upstream/gh-pages || true

# We build the dependencies of the demo. We replace the `.gitignore`
# file with a version where these dependencies are not ignored.
echo Building dependencies of the demo...
npm run build
cp gh-pages.gitignore .gitignore
echo Finished building dependencies of the demo.

# TODO: The original does this "so that `git` considers all of our<commit_msg>Rename branch `master` to `main`. This changes our deployment script.<commit_after>#!/bin/bash

# Build the `main` branch, and deploy it to the `gh-pages` branch.

# This is adapted from
# <http://www.steveklabnik.com/automatically_update_github_pages_with_travis_example/>.

# If there's an error during any command, exit the script. If any
# unset environment variable is used, exit the script.
set -o errexit -o nounset

# We only proceed if this deployment was triggered by a commit to
# `main`.
test "$TRAVIS_PULL_REQUEST" == "false" || exit 0
test "$TRAVIS_BRANCH" == "main" || exit 0

# We're going to make a commit to the gh-pages branch that looks a lot
# like the current commit on `main`.
git config user.name "$(git log -1 --pretty=%an HEAD)"
git config user.email "$(git log -1 --pretty=%ae HEAD)"
message="$(git log -1 --pretty=%B HEAD)"

# Without changing the state of the working copy, we reset to the
# `gh-pages` branch on GitHub. If the branch doesn't exist, we proceed
# anyway (`|| true`); we'll end up creating the branch ourselves.
git remote add rocketnia-upstream \
  "https://$ROCKETNIA_GH_TOKEN@github.com/rocketnia/mise-en.cene.git"
git fetch -q rocketnia-upstream
git reset rocketnia-upstream/gh-pages || true

# We build the dependencies of the demo. We replace the `.gitignore`
# file with a version where these dependencies are not ignored.
echo Building dependencies of the demo...
npm run build
cp gh-pages.gitignore .gitignore
echo Finished building dependencies of the demo.

# TODO: The original does this "so that `git` considers all of our
{'fraction_non_alphanumeric': 0.10418006430868167, 'fraction_numerical': 0.003215434083601286, 'mean_word_length': 4.237373737373737, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '6284764', 'n_tokens_mistral': 972, 'n_tokens_neox': 927, 'n_words': 414}