使用 fastlane 部署后从 hockey 下载 url

Get download url from hockey after deploy with fastlane

我现在正在使用 fastlane,我可以 post 像这样放松。

version = get_version_number(xcodeproj: "***")

slack(
  message: "<!here|here>: New :ios: *#{version}* has been submitted to Dev Hockey :rocket:.",
)

在终端中,部署完成后我看到了类似的内容。我怎样才能让 url 和 post 自动松弛?

[15:35:04]: Public Download URL: https://upload.hockeyapp.net/apps/52da8f2b3da60cf8b6d4eaas5f06ae9b

我正在阅读他们的代码,他们正在向终端打印类似这样的内容。但是,我不知道如何检索和 post 松懈。

https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/hockey.rb

我从这个 link 找到了如何 post 下载曲棍球 url 以放松 link。

http://rolandleth.com/fastlane-fastfile-3

  slack_params = {
    message: 'iOS App successfully released to Hockey!',
    payload: {
      # 'Date' => "#{t.year}-#{t.month}-#{t.day} #{t.hour}:#{t.min} (#{t.zone})",
      # Because we increase the version after each build,
      # but submit before the increase
      'Build' => "#{build_number.to_i - 1}",
      'Version' => version_number,
      'Type' => type
    },
    default_payloads: [:git_branch, :git_author, :last_git_commit]
  }

  if release_lane lane
    slack_params[:message] = 'iOS App successfully submitted to the App Store!'

    commit_tag_and_update_release_branch
  else
    slack_params[:payload]['Download Link'] = "#{Actions.lane_context[Actions::SharedValues::HOCKEY_DOWNLOAD_LINK]}"
  end

  slack slack_params

Khant Thu Linn 你找到了一个很好的片段。 在 fastlane 文档中,您可以看到 all context variables。 要下载曲棍球应用程序 link 使用

lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] 

将由 hockey 生成。

这可能是您的 fastfile 的 Slack 调用示例:

slack(
    message: "New :ios: version has been submitted to Hockey :rocket:.",
    payload: {  
        "Hockey App Download URL" => lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] 
    }
)