default_platform(:ios)

# Credentials are managed via `pass` (GPG + Gitea).
# Usage: pass show apple/mealmood/<key>
# Required before running lanes:
#   export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=$(pass show apple/mealmood/app-specific-password-fastlane)

platform :ios do
  EXPORT_OPTIONS = {
    method: "app-store",
    signingStyle: "manual",
    manageAppVersionAndBuildNumber: false,
    provisioningProfiles: {
      "com.alexandrevazquez.mealmood" => "com.alexandrevazquez.mealmood AppStore",
      "com.alexandrevazquez.mealmood.widget" => "com.alexandrevazquez.mealmood.widget AppStore"
    }
  }

  desc "Push a new beta build to TestFlight"
  lane :beta do
    increment_build_number(xcodeproj: "MealMood.xcodeproj")
    build_app(
      scheme: "MealMood",
      export_method: "app-store",
      sdk: "iphoneos26.4",
      export_options: EXPORT_OPTIONS
    )
    upload_to_testflight(skip_waiting_for_build_processing: true)
  end

  desc "Push a new release build to the App Store"
  lane :release do
    increment_build_number(xcodeproj: "MealMood.xcodeproj")
    build_app(
      scheme: "MealMood",
      sdk: "iphoneos26.4",
      export_options: EXPORT_OPTIONS
    )
    upload_to_app_store(force: true)
  end
end
