build_app不会拾取Fastlane Match环境变量



我开始在jenkins上使用fastLane和match进行代码签名。match能够成功创建证书和配置文件。但是build_app步骤失败,因为pbxproj文件正在将CODE_SIGN_STYLE设置为Automatic。我想在不修改pbxproj文件的情况下实现构建,因为开发人员使用自动签名。

FastFile

lane :upload_debug_test_flight do
setup_jenkins
match
build_app(scheme: "MyWork Dev", clean: true, export_method: "app-store")
upload_to_testflight(.....)
end

匹配文件:

git_url("git@github.mywork/cert_repo.git")
storage_mode("git")
type("appstore")
api_key_path("./test.json")
app_identifier(["com.mywork.mywork-test"])
username("developer@mywork.com")

在我们的项目.pbxproj中,我们有

CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
PROVISIONING_PROFILE_SPECIFIER= ''

也尝试了以下操作,但gym/build_app仍然没有选择匹配的env变量:

build_app(
skip_profile_detection: true,
export_method: "app-store",
export_options:{
signingStyle: "manual",
provisioningProfiles:{
"com.mywork.mywork-test": "match AppStore com.mywork.mywork-test"
}
}
)

Gym(build_app(使用Match定义的配置文件映射进行归档(export_options(,但不用于构建应用程序(这是两个不同的步骤(。

因此,您需要将Xcode项目配置为使用特定的概要文件,或者在调用build_app之前更新PROVISIONING_PROFILE_SPECIFIER值。

如果开发人员仅使用Debug配置,则可以在DebugRelease之间指定不同的设置。通过这种方式,您可以为Debug配置保留Automatic选项,并为Release配置手动指定代码签名标识和配置文件。

如果你根本不想接触你的Xcode项目并从fastlane动态定义所有内容,你可以使用update_code_signing_settings操作来使用Match:管理的配置文件

match(...)
profile_mapping = Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
update_code_signing_settings(
use_automatic_signing: false,
path: "path/to/your/project.xcodeproj",
profile_name: profile_mapping['app_identifier'] # app_identifier could be an environment variable: ENV['APP_ID']
)
build_app(...)

另一种解决方案是将PROVISIONING_PROFILE_SPECIFIER变量传递给xcargs选项。请注意,它将更新您所有目标中的值,因此,例如,如果您有一个具有不同配置文件的应用程序扩展,它可能不起作用。

build_app(
...
xcargs: "PROVISIONING_PROFILE_SPECIFIER='profile_name'"
)

最新更新