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

set -e

if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_REPO_SLUG == "yakworks/view-tools" && $TRAVIS_PULL_REQUEST == 'false' ]]; then

    if [[ -n $TRAVIS_TAG ]]
    then
        echo "### publishing release to BinTray"
        ./gradlew view-tools:bintrayUpload --no-daemon
    else
         echo "### publishing snapshot"
        ./gradlew view-tools:publish --no-daemon
    fi

    if [[ $TRAVIS_BRANCH == 'master' ]]
    then

        echo "### publishing docs"
        git config --global user.name "9cibot"
        git config --global user.email "<EMAIL>"
        git config --global credential.helper "store --file=~/.git-credentials"
        echo "https://$GITHUB_TOKEN:@github.com" > ~/.git-credentials
        git clone https://${GITHUB_TOKEN}@github.com/yakworks/view-tools.git -b gh-pages gh-pages --single-branch > /dev/null

        python3 -m mkdocs build

        cd gh-pages
        cp -r ../site/. . #Copy Mkdocs

        mkdir -p api #Copy Java API
        cp -r ../plugin/build/docs/groovydoc/. ./api

        git add .

        #If there are any changes, do commit and push
        if [[ -n $(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -E  "(mkdocs\.yml|docs/)") ]]
        then
            git commit -a -m "Update docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID"
            git push origin HEAD
        else
            echo "### No changes to docs"
        fi

        cd ..
        rm -rf gh-pages
        rm -rf site
        echo "### Done publishing docs"
    fi

else
  echo "Not a Tag or Not on master branch, not publishing"
  echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"
  echo "TRAVIS_TAG: $TRAVIS_TAG"
  echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
  echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
fi<commit_msg>Fix travis doc publishing<commit_after>#!/usr/bin/env bash

set -e

if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_REPO_SLUG == "yakworks/view-tools" && $TRAVIS_PULL_REQUEST == 'false' ]]; then

    if [[ -n $TRAVIS_TAG ]]
    then
        echo "### publishing release to BinTray"
        ./gradlew view-tools:bintrayUpload --no-daemon
    else
         echo "### publishing snapshot"
        ./gradlew view-tools:publish --no-daemon
    fi

    if [[ $TRAVIS_BRANCH == 'master' ]] && [[ -n $(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -E  "(mkdocs\.yml|docs/)") ]]
    then
        echo "### publishing docs"
        git config --global user.name "9cibot"
        git config --global user.email "<EMAIL>"
        git config --global credential.helper "store --file=~/.git-credentials"
        echo "https://$GITHUB_TOKEN:@github.com" > ~/.git-credentials
        git clone https://${GITHUB_TOKEN}@github.com/yakworks/view-tools.git -b gh-pages gh-pages --single-branch > /dev/null

        python3 -m mkdocs build

        cd gh-pages
        cp -r ../site/. . #Copy Mkdocs

        mkdir -p api #Copy Java API
        cp -r ../plugin/build/docs/groovydoc/. ./api

        git add .

        #If there are any changes, do commit and push
        git commit -a -m "Update docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID"
        git push origin HEAD

        cd ..
        rm -rf gh-pages
        rm -rf site
        echo "### Done publishing docs"
    else
        echo "### No changes to docs"
    fi

else
  echo "Not a Tag or Not on master branch, not publishing"
  echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"
  echo "TRAVIS_TAG: $TRAVIS_TAG"
  echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
  echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
fi
{'fraction_non_alphanumeric': 0.13388203017832648, 'fraction_numerical': 0.0010973936899862826, 'mean_word_length': 2.2408888888888887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 6, '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': '5478442', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1266, 'n_words': 335}