【问题标题】:Continously deploy from Unity Cloud Build to Google Play Store从 Unity Cloud Build 持续部署到 Google Play 商店
【发布时间】:2017-04-14 04:53:19
【问题描述】:

是否有任何部署工具可以弥合 Unity Cloud Build 和 Google Play 商店之间的差距,以便将生成的 APK 持续部署到商店?

【问题讨论】:

  • 我没有找到任何直接链接。如果你找到任何东西,请在这里分享。间接方式是使用github.com/fastlane/fastlane(从 Unity Cloud 创建一个 github 自动化构建并将其发送到 fastlane)?

标签: android unity3d google-play unity3d-cloud-build unity-cloud-build


【解决方案1】:

这是一个老问题,但仍然非常有效。我已经搞砸了一段时间。曾经为此有一个非常复杂的 bash 脚本,直到我意识到安装了 fastlane,并且您可以在构建后事件的 bash 脚本中轻松使用它。现在它实际上是一个 4 行脚本(减去 cmets),这里是:

#!/bin/bash

# Passed in as environment variables from CI, you must get this from Google and put
# it in the environment variable PLAYSTORE_KEY in the Unity build config.
# $PLAYSTORE_KEY - The JSON file with the credentials for the Google Developer account

# You can also just hardcode your package name, e.g. com.candycrush.game or whatever here...
PACKAGE_NAME=$(cat "$WORKSPACE/build.json" | jq -j '.[].bundleid')

# Unity environment variables replace the "\n" signs from the private key with spaces for some reason,
# so we replaces spaces with "\n" signs again so it works properly.
KEY_WITH_NEWLINES=$(echo $PLAYSTORE_KEY | jq '.private_key |= sub(" (?!PRIVATE|KEY)"; "\n"; "g")' -c -j)

# You could also use shorter argument names here, but DO NOT use -e for --release-status, there's some error there where
# fastlane thinks -e should mean the -env option and fails.
# Also, you could put the "draft" and "internal" into environment variables if you want to never have to modify the script
# again and just control it with environment variables.
fastlane supply --package_name "$PACKAGE_NAME" --aab "$UNITY_PLAYER_PATH"  --json_key_data "$KEY_WITH_NEWLINES" --release-status draft --track internal

所以只需将它放在“upload.sh”文件中,将其添加为构建配置中的构建后文件。以 json 格式获取您的 google 密钥并将其作为环境变量“PLAYSTORE_KEY”放入。不需要额外的 fastlane 配置,令人惊喜的是,它实际上只需要传入正确的参数即可。

【讨论】:

  • 能否请您详细说明如何获取 json 格式的密钥?
  • 您需要创建一个服务帐户,然后将其凭据作为 json 文件获取。见developers.google.com/android-publisher/…
  • 谢谢!我以为我必须对 Android Studio 做点什么。这更有意义。
  • 快车道 CLI 是否已经存在于 UCB 的构建代理中?不需要安装吗?
  • 是的,它已经存在,无需额外安装。
猜你喜欢
  • 1970-01-01
  • 2013-02-15
  • 2020-09-03
  • 1970-01-01
  • 1970-01-01
  • 2017-01-29
  • 1970-01-01
  • 2013-06-04
  • 1970-01-01
相关资源
最近更新 更多