1#! /bin/bash 2 3if [ -z "$TRAVIS_TAG" ]; then 4 # Only sign and deploy tags 5 echo "Not signing build. There is no git tag." 6 exit 0 7fi 8 9./gradlew :LottieSample:assembleRelease 10 11./gradlew -DORG_GRADLE_PROJECT_mavenCentralUsername=$SONATYPE_USERNAME -DORG_GRADLE_PROJECT_mavenCentralPassword=$SONATYPE_PASSWORD :lottie:publish 12 13echo "----------Signing APK" 14jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore lottie-upload-key.jks -storepass $LOTTIE_UPLOAD_CERT_KEY_STORE_PASSWORD LottieSample/build/outputs/apk/release/LottieSample-release-unsigned.apk upload -keypass $LOTTIE_UPLOAD_CERT_KEY_PASSWORD -signedjar LottieSample/build/outputs/apk/release/LottieSample-release-signed.apk 15 16if [ $? -ne 0 ]; then 17 exit $? 18fi 19 20echo "----------Zipaligning APK" 21${ANDROID_HOME}/build-tools/27.0.3/zipalign 4 LottieSample/build/outputs/apk/release/LottieSample-release-signed.apk LottieSample/build/outputs/apk/release/LottieSample-release-aligned.apk 22