我正在使用 Fastlane 來自動化我的 React Native 應用程式的 iOS 和 Android 版本。它作業得很好,我只是努力讓當前的 Android 版本號在應用程式部署后傳遞到 Slack 訊息中。以下是我目前的 Android 通道:
lane :deploy_staging do
gradle(task: "clean")
puts "CONFIG: #{ENV['CONFIG']}"
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
)
upload_to_play_store(track: 'internal')
slack(
message: "Test successfully deployed to Play Store",
success: true,
slack_url: "https://hooks.slack.com/services/test",
attachment_properties: {
fields: [
{
title: "Environment",
value: "Staging",
}
]
}
)
end
對于 iOS,我運行以下命令以獲取版本號:
{
title: "Version number",
value: get_version_number(target:"testapp"),
}
但是對于Android似乎沒有這種方法呼叫,有沒有一種簡單的方法可以讓我拉入版本號?
uj5u.com熱心網友回復:
您可以將版本代碼和版本名稱設定為區域變數并手動將它們傳遞給您的 gradle 方法。然后在你的松弛方法中使用它們。嘗試這樣的事情:
versionCode = 100
versionName = "1.0.0"
#...
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
properties: {
"versionCode" => versionCode,
"versionName" => versionName,
}
)
#...
slack(
message: "Test version code: #{versionCode} and version name: #{versionName} successfully deployed to Play Store",
success: true,
slack_url: "https://hooks.slack.com/services/test",
attachment_properties: {
fields: [
{
title: "Environment",
value: "Staging",
}
]
}
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/355005.html
下一篇:添加華為套件時出現“Couldnotfindcom.huawei.hms:location:6.0.0.302”錯誤
