<commit_before>#!/bin/sh
set -e

export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master}
export DEVELOPMENT_BRANCH=${DEVELOPMENT_BRANCH:-development}

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

# #clone the repository
git clone --quiet --branch=apk https://fossasia:$GITHUB_API_KEY@github.com/fossasia/pslab-android apk > /dev/null
cd apk

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    rm -rf *
else 
    rm -rf pslab-dev*
fi

\cp -r ../app/build/outputs/apk/*/*/**.apk .

# Signing Apps

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    echo "Push to master branch detected, signing the app..."
    # Retain apk files for testing
    mv app-playstore-debug.apk pslab-master-debug.apk
    mv app-fdroid-debug.apk pslab-master-debug-fdroid.apk
    # Generate temporary apk for signing
    mv app-playstore-release.apk pslab-master-release.apk
    mv app-fdroid-release.apk pslab-master-release-fdroid.apk
    
    git checkout apk
    git add -A
    git commit -am "Travis build pushed [master]"
    git push origin apk --force --quiet> /dev/null
fi

if [ "$TRAVIS_BRANCH" == "$DEVELOPMENT_BRANCH" ]; then
    echo "Push to development branch detected, generating apk..."
    # Rename apks with dev prefixes
    mv app-playstore-debug.apk pslab-dev-debug.apk
    mv app-fdroid-debug.apk pslab-dev-debug-fdroid.apk

    mv app-playstore-release.apk pslab-dev-release.apk
    mv app-fdroid-release.apk pslab-dev-release-fdroid.apk
    # Push generated apk files to apk branch
    git checkout apk
    git add -A
    git commit -am "Travis build pushed [development]"
    git push origin apk --force --quiet> /dev/null
fi

# Publish App to Play Store
if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    gem install fastlane
    fastlane supply --apk pslab-master-release.apk --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME
fi
<commit_msg>aab added to build script (#1890)<commit_after>#!/bin/sh
set -e

export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master}
export DEVELOPMENT_BRANCH=${DEVELOPMENT_BRANCH:-development}

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

# #clone the repository
git clone --quiet --branch=apk https://fossasia:$GITHUB_API_KEY@github.com/fossasia/pslab-android apk > /dev/null
cd apk

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    rm -rf *
else 
    rm -rf pslab-dev*
fi

# Signing Apps

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    ./gradlew bundlePlaystoreRelease

    find ../app/build/outputs -type f \( -name "*.aab" -o -name ".apk" \) -exec cp {} . \;

    echo "Push to master branch detected, signing the app..."
    # Retain apk files for testing
    mv app-playstore-debug.apk pslab-master-debug.apk
    mv app-fdroid-debug.apk pslab-master-debug-fdroid.apk
    # Generate temporary apk for signing
    mv app-playstore-release.apk pslab-master-release.apk
    mv app-fdroid-release.apk pslab-master-release-fdroid.apk
    mv app.aab pslab-master.aab

    git checkout apk
    git add -A
    git commit -am "Travis build pushed [master]"
    git push origin apk --force --quiet> /dev/null
fi

if [ "$TRAVIS_BRANCH" == "$DEVELOPMENT_BRANCH" ]; then
    find ../app/build/outputs -type f -name "*.apk" -exec cp {} . \;

    echo "Push to development branch detected, generating apk..."
    # Rename apks with dev prefixes
    mv app-playstore-debug.apk pslab-dev-debug.apk
    mv app-fdroid-debug.apk pslab-dev-debug-fdroid.apk

    mv app-playstore-release.apk pslab-dev-release.apk
    mv app-fdroid-release.apk pslab-dev-release-fdroid.apk
    # Push generated apk files to apk branch
    git checkout apk
    git add -A
    git commit -am "Travis build pushed [development]"
    git push origin apk --force --quiet> /dev/null
fi

# Publish App to Play Store
if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
    gem install fastlane
    fastlane supply --aab pslab-master.aab --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME
fi

{'fraction_non_alphanumeric': 0.12425889328063242, 'fraction_numerical': 0.0009881422924901185, 'mean_word_length': 3.140081799591002, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '76870', 'n_tokens_mistral': 1543, 'n_tokens_neox': 1419, 'n_words': 392}