# 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 "Builds the debug code"
  lane :buildDebug do
    gradle(task: "assembleDebug")
  end

  desc "Builds the release code"
  lane :buildRelease do
    gradle(tasks: ["bundleRelease", "assembleRelease"])
  end

  desc "Runs all the tests"
  lane :test do
    gradle(task: "test")
  end

  desc "Submit a new Internal Build to Play Store"
  lane :internal do
    upload_to_play_store(
      track: 'internal',
      skip_upload_metadata: true,
      skip_upload_images: true,
      skip_upload_screenshots: true,
      aab: 'app/build/outputs/bundle/release/app-release.aab'
    )
  end

  desc "Promote Internal to Beta"
  lane :promote_internal_to_beta do
    upload_to_play_store(
      track: 'internal',
      skip_upload_metadata: true,
      skip_upload_images: true,
      skip_upload_screenshots: true,
      skip_upload_changelogs: true,
      track_promote_to: 'beta'
    )
  end

  desc "Promote Beta to Production"
  lane :promote_beta_to_production do
    upload_to_play_store(
      track: 'beta',
      skip_upload_changelogs: true,
      track_promote_to: 'production'
    )
  end
end
