# 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(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end
# desc: Đây là một từ khóa trong Ruby được sử dụng để mô tả nhiệm vụ. Nó không phải là một phần của ngôn ngữ Ruby mà chỉ được sử dụng trong Fastlane để cung cấp mô tả cho các tác vụ.
# lane: Là một phương thức trong Fastlane để định nghĩa một loạt các công việc liên quan có thể được thực thi cùng nhau.
# release_app: Một lane được định nghĩa để tổ chức việc phát hành ứng dụng lên App Store. Nó gọi hai nhiệm vụ: export_app và upload_app.
# export_app: Một lane khác để xuất ứng dụng từ mã nguồn của bạn. Nó sử dụng gym để tạo một file IPA cho ứng dụng của bạn. gym là một công cụ trong Fastlane để xây dựng và xuất ứng dụng iOS.
# upload_app: Một lane khác để tải ứng dụng đã được xuất lên App Store. Nó sử dụng deliver để thực hiện công việc này. deliver là một công cụ trong Fastlane để tự động hóa việc tải ứng dụng lên App Store Connect.
  desc "Releases our app to the appstore"
  lane :release_app do 
    export_app 
    upload_app
  end
  desc "To export our app"
  lane :export_app do
    gym(
      project: "Runner.xcodeproj",
      scheme: "Runner",
      clean: true,
      export_xcargs: "-allowProvisioningUpdates",
      output_name: "ReleaseApp1.ipa"
    )
  end

  desc "To deliver our app"
  lane :upload_app do 
    deliver(
      ipa: "ReleaseApp1.ipa",
      skip_screenshots: true,
      skip_metadata: true,
      skip_app_version_update: true,
      force: true
    )
  end
  # Lane for debugging purposes
desc "For debugging purposes"
lane :debug do
  puts "Starting debug process..."

  # Print environment variables
  puts "Environment variables:"
  puts ENV

  # Print lane context
  puts "Lane context:"
  puts Actions.lane_context

  puts "Debug process completed."
end
end
