在某些情况下,我们需要覆盖 fastlane 的 appfile 中的值,例如使用不同的苹果帐户发布应用程序,但没有正式记录的方式。
9042 次
3 回答
28
最简单的方法是使用环境变量:
使用Appfile
这样的:
apple_id ENV["APPLE_ID"] || "default@company.com"
app_identifier ENV["APP_IDENTIFIER"] || "com.company.default"
当您现在在没有环境变量的情况下调用fastlane时:
fastlane beta
它将使用提供的默认值 ( default@company.com
)
设置一个不同的值,你可以使用
APP_IDENTIFIER="com.custom.app" fastlane enterprise
同样正如其他回复已经指出的那样,您始终可以为不同的环境拥有多个通道,并且只需将不同的应用标识符或用户名传递给您正在调用的每个操作。
于 2016-05-19T16:48:59.270 回答
5
我们找到了一种方法来做到这一点,在主项目文件夹中使用一个被忽略的 .env 文件。
它可用于覆盖 appfile 中的值,如下所示:
require('dotenv')
Dotenv.load '../.env'
app_identifier "original.app.identifier" # The bundle identifier of your app
apple_id "account@example.com" # Your Apple email address
team_name "originalTeamName"
team_id "originalTeamID"
unless ENV["N42_FASTLANE_APP_IDENTIFIER"].nil?
app_identifier ENV["N42_FASTLANE_APP_IDENTIFIER"]
end
unless ENV["N42_FASTLANE_APPLE_ID"].nil?
apple_id ENV["N42_FASTLANE_APPLE_ID"]
end
unless ENV["N42_FASTLANE_TEAM_NAME"].nil?
team_name ENV["N42_FASTLANE_TEAM_NAME"]
end
unless ENV["N42_FASTLANE_TEAM_ID"].nil?
team_id ENV["N42_FASTLANE_TEAM_ID"]
end
在 .env 文件中设置新值,如下所示:
N42_FASTLANE_APPLE_ID="anotherAccount@example.com"
于 2016-05-05T17:59:47.583 回答
1
Appfile
支持覆盖不同通道的值:https ://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md。
您还可以在您的 s 中指定不同team_id
的 s、username
s 和app_identifier
s Fastfile
,例如:
lane :example_lane do
cert(
username: "email@company.com",
team_id: "ABCDE123"
)
sigh(
username: "email@company.com",
team_id: "ABCDE123",
app_identifier: "com.company.example.app"
)
gym(
export_team_id: "ABCDE123"
)
end
于 2016-05-19T12:01:15.583 回答