diff --git a/.gitignore b/.gitignore index 6f4cb14..d976a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -143,3 +143,9 @@ configuration\.tar \.idea/caches/build_file_checksums\.ser \.idea/caches/ + +play_store_credentials\.json + +fastlane/README\.md + +fastlane/report\.xml diff --git a/.travis.yml b/.travis.yml index d2a50f8..e7cfe07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,12 +19,12 @@ before_install: - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" - - openssl aes-256-cbc -K $encrypted_8906d6504312_key -iv $encrypted_8906d6504312_iv -in configuration.tar.enc -out configuration.tar -d + - openssl aes-256-cbc -K $encrypted_3fe6ca7ef0d3_key -iv $encrypted_3fe6ca7ef0d3_iv -in configuration.tar.enc -out configuration.tar -d - tar xvf configuration.tar - mv ${TRAVIS_BUILD_DIR}/google-services.json ${TRAVIS_BUILD_DIR}/app/google-services.json - cp local.properties.ci local.properties - ls -all - - source scripts/writeEnvVariables.sh && copyEnvVarsToManifest && copyEnvVarsToSigningProperties + - source scripts/writeEnvVariables.sh && copyEnvVarsToManifest && copyEnvVarsToSigningProperties && copyEnvVarsToFastlaneConfiguration - docker pull influxdb - docker run --name=influxdb -d -p 127.0.0.1:8086:8086 influxdb - docker ps -a @@ -50,10 +50,11 @@ script: - curl -i -XPOST http://127.0.0.1:8086/query --data-urlencode "q=CREATE DATABASE test" - ./gradlew clean test build before_deploy: + - bundle install && bundle update fastlane - cd app/build/outputs/apk/release - - jarsigner -verbose -tsa http://timestamp.comodoca.com/rfc3161 -sigalg SHA1withRSA -digestalg SHA1 -keystore ${TRAVIS_BUILD_DIR}/ApollineKeystore.jks -storepass $STORE_PASSWORD -keypass $KEY_PASSWORD app-release-unsigned.apk $KEY_ALIAS - - jarsigner -verify app-release-unsigned.apk - - ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -v 4 app-release-unsigned.apk Apolline.apk + - ls -all + - bundle exec fastlane supply --apk Apolline*.apk + - mv Apolline*.apk Apolline.apk deploy: provider: releases skip_cleanup: true @@ -61,4 +62,4 @@ deploy: api_key: $GH_TOKEN on: repo: Apolline-Lille/apolline-android - tags: true + tags: true \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..54961dc --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,152 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.0) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.2) + babosa (1.0.2) + claide (1.0.2) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.10) + declarative-option (0.1.0) + domain_name (0.5.20180417) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.4.0) + emoji_regex (0.1.1) + excon (0.62.0) + faraday (0.15.0) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (0.12.2) + faraday (>= 0.7.4, < 1.0) + fastimage (2.1.1) + fastlane (2.93.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + babosa (>= 1.0.2, < 2.0.0) + bundler (>= 1.12.0, < 2.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (~> 0.1) + excon (>= 0.45.0, < 1.0.0) + faraday (~> 0.9) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 0.9) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.13.1, < 0.14.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + mini_magick (~> 4.5.1) + multi_json + multi_xml (~> 0.5) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + public_suffix (~> 2.0.0) + rubyzip (>= 1.1.0, < 2.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 1.6.2, < 2.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.5.7, < 2.0.0) + xcpretty (>= 0.2.4, < 1.0.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-api-client (0.13.6) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.5) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + googleauth (0.6.2) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + json (2.1.0) + jwt (2.1.0) + little-plugger (1.1.4) + logging (2.2.2) + little-plugger (~> 1.1) + multi_json (~> 1.10) + memoist (0.16.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_magick (4.5.1) + multi_json (1.13.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nanaimo (0.2.5) + naturally (2.1.0) + os (0.9.6) + plist (3.4.0) + public_suffix (2.0.5) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.1) + rouge (2.0.7) + rubyzip (1.2.1) + security (0.1.3) + signet (0.8.1) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.4) + CFPropertyList + naturally + slack-notifier (2.3.2) + terminal-notifier (1.8.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.5.0) + tty-screen (0.6.4) + tty-spinner (0.8.0) + tty-cursor (>= 0.5.0) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) + unicode-display_width (1.3.2) + word_wrap (1.0.0) + xcodeproj (1.5.7) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.2) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.4) + xcpretty (0.2.8) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 1.16.1 diff --git a/app/build.gradle b/app/build.gradle index c927f08..9022e62 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,6 +75,14 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release + + android.applicationVariants.all { variant -> + variant.outputs.all { + def date = new Date() + def formattedDate = date.format('dd-MM-yyyy') + outputFileName = "Apolline-${variant.versionName}-${formattedDate}.apk" + } + } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c5a3a49..a413ebb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,7 +18,6 @@ - @@ -49,26 +48,16 @@ android:hardwareAccelerated="true" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> - - - - - - - + android:value="${fabric_api_key}"/> - @@ -106,4 +95,4 @@ - + \ No newline at end of file diff --git a/configuration.tar.enc b/configuration.tar.enc index 288cdd0..bfb989a 100644 Binary files a/configuration.tar.enc and b/configuration.tar.enc differ diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000..22c0647 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("${secret_credentials}") +package_name("science.apolline") diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..3556333 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,34 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:android) + +platform :android do + desc "Runs all the tests" + lane :test do + gradle(task: "test") + end + + desc "Submit a new Beta Build to Crashlytics Beta" + lane :beta do + gradle(task: "clean assembleRelease") + crashlytics + + # sh "your_script.sh" + # You can also use other beta testing services here + end + + desc "Deploy a new version to the Google Play" + lane :deploy do + gradle(task: "clean assembleRelease") + upload_to_play_store + end +end diff --git a/keystore.properties b/keystore.properties index 54a1ab7..433eab9 100644 --- a/keystore.properties +++ b/keystore.properties @@ -1,4 +1,4 @@ storePassword=myStorePassword -keyPassword=mykeyPassword +keyPassword=myKeyPassword keyAlias=myKeyAlias storeFile=myStoreFile \ No newline at end of file diff --git a/scripts/writeEnvVariables.sh b/scripts/writeEnvVariables.sh index 5f1d623..2a1537c 100644 --- a/scripts/writeEnvVariables.sh +++ b/scripts/writeEnvVariables.sh @@ -2,7 +2,6 @@ function copyEnvVarsToManifest { ANDROID_MANIFEST=${TRAVIS_BUILD_DIR}"/app/src/main/AndroidManifest.xml" - export ANDROID_MANIFEST echo "AndroidManifest should exist at $ANDROID_MANIFEST" sed -i -e "s/\"\${google_map_api_key}\"/"\"$GOOGLE_MAP_API_KEY\""/g" $ANDROID_MANIFEST @@ -11,11 +10,17 @@ function copyEnvVarsToManifest { function copyEnvVarsToSigningProperties { KEYSTORE_AUTH=${TRAVIS_BUILD_DIR}"/keystore.properties" - export KEYSTORE_AUTH echo "keystore.properties should exist at $KEYSTORE_AUTH" sed -i -e "s/myStorePassword/"$STORE_PASSWORD"/g" $KEYSTORE_AUTH - sed -i -e "s/mykeyPassword/"$KEY_PASSWORD"/g" $KEYSTORE_AUTH + sed -i -e "s/myKeyPassword/"$KEY_PASSWORD"/g" $KEYSTORE_AUTH sed -i -e "s/myKeyAlias/"$KEY_ALIAS"/g" $KEYSTORE_AUTH sed -i -e "s_myStoreFile_"${TRAVIS_BUILD_DIR}/${STORE_FILE}"_g" $KEYSTORE_AUTH +} + +function copyEnvVarsToFastlaneConfiguration { + FASTLANE_CREDENTIAL=${TRAVIS_BUILD_DIR}"/fastlane/Appfile" + export FASTLANE_CREDENTIAL + echo "Appfile should exist at $FASTLANE_CREDENTIAL" + sed -i -e "s/\"\${secret_credentials}\"/"\"$FASTLANE_FILE\""/g" $FASTLANE_CREDENTIAL } \ No newline at end of file