diff --git a/.ci/set_tag.sh b/.ci/set_tag.sh new file mode 100644 index 0000000..a3de10c --- /dev/null +++ b/.ci/set_tag.sh @@ -0,0 +1,24 @@ +BRANCH="master" + +# Are we on the right branch? +if [ "$TRAVIS_BRANCH" = "$BRANCH" ]; then + + # Is this not a Pull Request? + if [ "$TRAVIS_PULL_REQUEST" = false ]; then + + # Is this not a build which was triggered by setting a new tag? + if [ -z "$TRAVIS_TAG" ]; then + echo -e "Starting to tag commit.\n" + + git config --global user.email "travis@travis-ci.org" + git config --global user.name "Travis" + + # Add tag and push to master. + git tag -a v${TRAVIS_BUILD_NUMBER} -m "Travis build $TRAVIS_BUILD_NUMBER pushed a tag." + git push origin --tags + git fetch origin + + echo -e "Done magic with tags.\n" + fi + fi +fi diff --git a/.gitignore b/.gitignore index 1cdc960..83cd77e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,7 @@ .externalNativeBuild .idea/ app/google-services.json +cloud.tar.gz +sahayak.jks +dummykeystore.properties diff --git a/.travis.yml b/.travis.yml index d10443c..e05b5aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,23 @@ language: android dist: trusty android: components: - # The BuildTools version used by your project - - build-tools-29.0.1 - - # The SDK version used to compile your project - - android-29 - -before_script: - - chmod +x gradlew - - openssl aes-256-cbc -K $encrypted_2844885ced97_key -iv $encrypted_2844885ced97_iv -in app/ci_secret.txt -out app/google-services.json -d - + - build-tools-29.0.1 + - android-29 +before_script: +- chmod +x gradlew +- openssl aes-256-cbc -K $encrypted_2844885ced97_key -iv $encrypted_2844885ced97_iv -in cloud.tar.gz.enc -out cloud.tar.gz -d +- tar -xvf cloud.tar.gz +- ls -la script: - - ./gradlew build +- "./gradlew clean build assembleRelease" +deploy: + skip_cleanup: true + provider: releases + api_key: + secure: ngLvYtd5/lQqLjm65B3vkBBwMKdbQEbkReBeKbJOwNogOOMcrFTBnKHOCud0otk0JMYZPYNI5Dcp8MaPcyqwrmmVTQRSCphx/xZbOYH9ivNisSJhAW7b/OO6bYFcFY1XyP3yrhJ4fAqHJA0JdCTlG7qY/BqkYKuBWG4xEdbkxfiD/MbD2nCP5yU2NQ2fejPcEBaK4rSRprF1WauugPfjaIxGoU8hmsbr+gGCBWbJ5Pi7cQEwRvaB4lz8afuBJ++J/fLB88HTs3dh0h31Pg7uSeBe+nJuZmwd0AviY4kQrjGN/LOV91cYajxEn+99Bx2gWwddY6yheT/hpjC8Ha1cTjWj7QytAnG1CAQdmNFAEk5qDR2TT+uxxdWjFBnODOBda39xTbsY71WFx24MHmicelaEozT4RvZb38JvwASv19uW3ZHnnqbLo+ocWD57KWPsucoKEuMQSpXoMDy6rLcDrgXz4HGA6JlpnKiJ505uSTZUdt8nCHRvgM1UnqaK7ENv9xGxKClCoRmJT4YkHZ+7g8du7TFSt21/HSwLtSRCRuFqjkOTxQSbYPmTmncn1ZMJto0u1D5ppQcffVvRVmwOO/3UyR9YWZ9v+IwR3VYTOdxvAFMeqDQpdHhQKtIQEPc4kpQI2TTF47ERvAzSvGBOlZuxx5oIUXsu44LuizKz8Co= + file: app/build/outputs/apk/release/app-release.apk + on: + branch: master + repo: virresh/Sahaayak +after_success: +- sh set_tags.sh \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 3bb2c0f..e9fea02 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,12 +11,26 @@ android { versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + release + } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } } + + def isRunningOnTravis = System.getenv("CI") == "true" + + if (isRunningOnTravis) { + // configure keystore + signingConfigs.release.storeFile = file(System.getenv("RELEASE_STORE_FILE")) + signingConfigs.release.storePassword = System.getenv("RELEASE_STORE_PASSWORD") + signingConfigs.release.keyAlias = System.getenv("RELEASE_KEY_ALIAS") + signingConfigs.release.keyPassword = System.getenv("RELEASE_KEY_PASSWORD") + } } apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin diff --git a/app/ci_secret.txt b/app/ci_secret.txt deleted file mode 100644 index 7c38eda..0000000 Binary files a/app/ci_secret.txt and /dev/null differ diff --git a/cloud.tar.gz.enc b/cloud.tar.gz.enc new file mode 100644 index 0000000..54904e9 Binary files /dev/null and b/cloud.tar.gz.enc differ