# Customise this file, documentation can be found here:
# https://docs.fastlane.tools/actions/
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.137.0"

default_platform :android

platform :android do
  before_all do
  	#ensure_git_status_clean
  end

  lane :beta do
  	ensure_git_branch(branch: 'dev')
  	git_pull
    gradle(task: 'clean assembleRelease')
  	supply(track: 'beta')
  end

  lane :production do
  	ensure_git_branch(branch: 'master')
  	git_pull
    gradle(task: 'clean assembleRelease')
  	supply(track: 'rollout', rollout: '0.1')
  end

  lane :listing_only do
    sh "bash ./remove_unsupported_languages.sh"
    supply(
      track: 'production',
      skip_upload_apk: 'true',
      skip_upload_images: 'true',
      skip_upload_screenshots: 'true',
      skip_upload_changelogs: true,
      skip_upload_aab: 'true'
    )
  end

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack(
    #   message: "Successfully deployed new App Update."
    # )
  end

  error do |lane, exception|
    # slack(
    #   message: exception.message,
    #   success: false
    # )
  end
end