# 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)

platform :android do
  desc "Build release APK and AAB"
  lane :build do
    gradle(
      task: 'clean assemble bundle',
      build_type: 'Release',
      flavor: 'production'
    )
  end

  desc "Deploy a new beta version to Google Play"
  lane :beta do
    upload_to_play_store(
      track: 'beta',
      aab: '../build/app/outputs/bundle/productionRelease/app-production-release.aab',
      skip_upload_apk: true,
      skip_upload_metadata: true,
      skip_upload_screenshots: true,
      skip_upload_images: true
    )
  end

  desc "Deploy a new version to the Google Play"
  lane :production_appbundle do
    upload_to_play_store(
      track: 'production',
      aab: '../build/app/outputs/bundle/productionRelease/app-production-release.aab',
      skip_upload_apk: true,
      skip_upload_metadata: true,
      skip_upload_screenshots: true,
      skip_upload_images: true
    )
  end

  desc "Build and deploy to beta"
  lane :deploy_beta do
    build
    beta
  end

  desc "Build and deploy to production"
  lane :deploy_production do
    build
    production_appbundle
  end
end
