美文网首页
flutter打包编译设置为蒲公英的最新版本

flutter打包编译设置为蒲公英的最新版本

作者: Crassus | 来源:发表于2023-08-21 14:20 被阅读0次
    
    # Fastfile
    
    platform :android do
      project_dir = 'android/'
    
      desc 'Android: 执行打包过程'
      private_lane :build do |options|
        sh('flutter clean')
        # gradle(task: 'clean', project_dir: project_dir)
        sh('flutter pub get')
        gradle(
          task: 'assemble',
          build_type: options[:type],
          project_dir: project_dir,
        )
      end
      
      desc 'Android: 打包上传蒲公英'
      lane :pgy do |options|
        apkType = options[:type] || 'Release'
        apkUrl = "#{File.expand_path("..", Dir.pwd)}/build/app/outputs/apk/#{apkType.downcase}/app-#{apkType.downcase}.apk"
        api_key = ""
        build(type: apkType)
        answer = pgyer(
          api_key: api_key, 
          apk: apkUrl,
          update_description: options[:desc])
        buildKey = "#{answer["buildKey"]}"
        # 设置为最新版本
        sh("curl -X POST -F _api_key=#{api_key} -F buildKey=#{buildKey} https://www.pgyer.com/apiv2/app/setNewestVersion")
      end
    
      desc 'Android本地打包'
      lane :buildApk do |options|
        apkType = options[:type] || 'Release'
        build(type: apkType)
      end
    end
    
    

    相关文章

      网友评论

          本文标题:flutter打包编译设置为蒲公英的最新版本

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