美文网首页
fastlane打包脚本

fastlane打包脚本

作者: iOSCoder_XH | 来源:发表于2018-12-18 14:00 被阅读14次

    Fastfile文件内容如下:

    default_platform(:ios)
    
    platform :ios do
    
    desc "打包 命令:fastlane dev desc:xxxxx upload:pgy"
      lane :dev do |option|
    
    
        app_info_plist_path = "./xxxx/info.plist"
        scheme_name = "xxxx"
    
    
        time_string = Time.now.strftime('%Y-%m-%d_%H:%M:%S')
    
        
        app_version = get_info_plist_value(path: "#{app_info_plist_path}", key: "CFBundleShortVersionString")
        app_build = get_info_plist_value(path: "#{app_info_plist_path}", key: "CFBundleVersion")
    
        app_version_build = "#{app_version}(#{app_build})"
    
        app_ipa_name = "#{scheme_name}_#{app_version_build}_#{time_string}"
    
        print("app_ipa_name: #{app_ipa_name}")
    
        #打包
        gym(
            scheme: "#{scheme_name}",
            export_method: "development",#打包所选的种类(就是App Store,生产测试,企业,开发测试那四种), app-store,ad-hoc,enterprise,development
              output_directory: "./build",
              output_name: "#{app_ipa_name}.ipa"
            )
    
        app_update_desc = "#{option[:desc]}"
    
    
    
      #上传到firim或pgy
        upload_type = "#{option[:upload]}"
    
        if upload_type == "firim"
            firim(
              firim_api_token:"xxxxx",
              app_changelog:"#{app_update_desc}"
              ) 
          end
    
        if upload_type == "pgy"
            pgyer(
              api_key: "xxxxx",
              user_key: "xxxxx",
              update_description: "#{app_update_desc}"
              )
          end
    
    
        clean_build_artifacts
        
      end
    
    end
    

    相关文章

      网友评论

          本文标题:fastlane打包脚本

          本文链接:https://www.haomeiwen.com/subject/iptlkqtx.html