<commit_before>#!/usr/bin/env bash
set -eu

cd "$(dirname "${BASH_SOURCE[0]}")/.."

sbt web/fastOptJS::webpack

mkdir -p target
cd target

if [ -d gh-pages ]; then
  echo "Removing former gh-pages clone"
  rm -rf gh-pages
fi

echo "Cloning"
git clone "https://${GH_TOKEN}@github.com/coursier/coursier.git" -q -b gh-pages gh-pages
cd gh-pages

git config user.name "Travis-CI"
git config user.email "<EMAIL>"

echo "Cleaning-up gh-pages"
git rm -r *

echo "Copying new website"
cp -pR ../../doc/website/build/coursier/* .
mkdir demo
cp ../../modules/web/target/scala-2.12/scalajs-bundler/main/web-fastopt-bundle.js demo/
sed 's@\.\./scalajs-bundler/main/@@g' < ../../modules/web/target/scala-2.12/classes/index.html > demo/index.html
cat > demo.html << EOF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=demo/" />
</head>
<body>
Redirecting to <a href="demo/">demo/</a>
</body>
</html>
EOF
git add .

MSG="Update website"

# probably not fine with i18n
if git status | grep "nothing to commit" >/dev/null 2>&1; then
  echo "Nothing changed"
else
  git commit -m "$MSG"

  echo "Pushing changes"
  git push origin gh-pages
fi<commit_msg>Don't remove CNAME file when updating website<commit_after>#!/usr/bin/env bash
set -eu

cd "$(dirname "${BASH_SOURCE[0]}")/.."

sbt web/fastOptJS::webpack

mkdir -p target
cd target

if [ -d gh-pages ]; then
  echo "Removing former gh-pages clone"
  rm -rf gh-pages
fi

echo "Cloning"
git clone "https://${GH_TOKEN}@github.com/coursier/coursier.git" -q -b gh-pages gh-pages
cd gh-pages

git config user.name "Travis-CI"
git config user.email "<EMAIL>"

echo "Cleaning-up gh-pages"
git mv CNAME .CNAME
git rm -r *
git mv .CNAME CNAME

echo "Copying new website"
cp -pR ../../doc/website/build/coursier/* .
mkdir demo
cp ../../modules/web/target/scala-2.12/scalajs-bundler/main/web-fastopt-bundle.js demo/
sed 's@\.\./scalajs-bundler/main/@@g' < ../../modules/web/target/scala-2.12/classes/index.html > demo/index.html
cat > demo.html << EOF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=demo/" />
</head>
<body>
Redirecting to <a href="demo/">demo/</a>
</body>
</html>
EOF
git add .

MSG="Update website"

# probably not fine with i18n
if git status | grep "nothing to commit" >/dev/null 2>&1; then
  echo "Nothing changed"
else
  git commit -m "$MSG"

  echo "Pushing changes"
  git push origin gh-pages
fi
{'fraction_non_alphanumeric': 0.1733500417710944, 'fraction_numerical': 0.010025062656641603, 'mean_word_length': 3.49343339587242, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '3792758', 'n_tokens_mistral': 966, 'n_tokens_neox': 904, 'n_words': 259}