default_platform(:ios)

platform :ios do
  desc "Push a new release build to the App Store"
  lane :release do
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
    upload_to_app_store
  end

  lane :internal do
    puts ("env :  #{ENV['ENV']}")  // 환경 확인용
    sh("bundle", "update") // gem 동기화용
    match(type:'appstore',readonly:true) // ios 프로비젼 확인
    increment_build_number(
    build_number: latest_testflight_build_number + 1,
    skip_info_plist:true
    )
    pod_install // pod install 
    flutter_build_ios
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner",    
      export_method: "app-store",
      export_xcargs: "-allowProvisioningUpdates")
    upload_to_testflight(skip_waiting_for_build_processing:true)
    send_slack
  end

  lane :pod_install do
    cocoapods(
      clean_install: true,
      # podfile: "Podfile"
     )
  end

  lane :send_slack do 
    version = get_version_number( xcodeproj: "Runner.xcodeproj", target: "Runner" )
     build = get_build_number(xcodeproj: "Runner.xcodeproj")
      slack( message: 슬랙에 보낼 메세지,
                 channel: "슬랙 채널 이름",
                  slack_url: "슬랙 웹훅 url", 
                  default_payloads: [:lane, :test_result, :git_branch, :git_author],
                   payload: { 
                     "Version": version + " (" + build + ")",
                   "Environment" => "빌드환경 : #{ENV['ENV']}"
                   }
                    ) 
    end

  # Flutter build iOS
  lane :flutter_build_ios do
    sh("cd", "..")
    puts "Flutter clean"
    sh("fvm","flutter", "clean")
    puts "Flutter build iOS"
    # sh("flutter", "build", "ios", "--no-codesign", "-t", ENV['MAIN_TARGET'])
    sh("fvm","flutter", "build", "ios","--dart-define=env=#{ENV['ENV']}")
  end

  lane :testfunc do
    puts ("env : #{ENV['ENV']}")
  end

  # Error handling
  error do |lane, exception|
    slack(
      channel: "#fastlane-ios",
      slack_url: "슬랙 웹훅 url", 
      message: "😱 "+exception.message,
      success: false
    )
  end

end
 
profile
자발개발자

0개의 댓글