# 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
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

import("Android")

platform :android do

  desc "Run unit tests"
  lane :unit_test do
    gradle(task: "assembleDebug")
    gradle(task: "assembleDebugUnitTest")
  end

  desc "Capture screenshots"
  lane :screenshots do
    gradle(task: "assembleDebug")
    gradle(task: "assembleDebugAndroidTest")

    capture_android_screenshots(
      locales: ["en-US", "uk"],
      app_package_name: "ua.bossly.tools.translit.dev",
      app_apk_path: "app/build/outputs/apk/debug/app-debug.apk",
      tests_apk_path: "app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
      exit_on_test_failure: false,
      use_timestamp_suffix: false
    )
    frame_screenshots
  end

  desc "Deploy a new version to the Google Play"
  lane :deploy do
    executeGradle("assembleRelease")

    upload_to_play_store(
        json_key_data: ENV["SUPPLY_JSON_KEY_DATA"]
    )
  end

end
