Method: Flutter::Upload#push_to_remote

Defined in:
lib/upload.rb

#push_to_remote(version) ⇒ Object

推到远程



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/upload.rb', line 215

def push_to_remote(version)
  log_products_diff
  # 当前的分支
  branch_name = `git branch --show-current`
  # 生成提交日志(版本号+构件类型+分支名)
  log = "版本号:#{version}---构件类型:#{@product_type.capitalize}---分支名:#{branch_name}"
  # 提交
  `git -C #{@framework_localPath} add -A`
  `git -C #{@framework_localPath} commit -m #{log}`
  `git -C #{@framework_localPath} push origin`
  # 打tag
  `git -C #{@framework_localPath} tag -a #{version} -m #{log}`
  `git -C #{@framework_localPath} push origin #{version}`

  # 切换到SoHuHost目录下执行`pod repo push`
  Dir.chdir(@framework_localPath) if @framework_localPath
  # podspec 推到远程
  result = system("pod repo push #{@spec_name} #{@podspec_name} --sources='#{@spec_url}' --allow-warnings --skip-import-validation")

  raise "上传失败。。。。。。" unless result

  print TTY::Box.success("#{@podspec_name}推送成功,请在项目中使用:\nflutter_pod '#{@sohu_host_project_name}', '#{version}'")
end