ios - FaSTLane Match 环境变量未被 build_app 获取

我开始使用 fastLane 并匹配 codesigning在 Jenkins 。 match 能够成功创建证书和配置文件。然而,build_app 步骤失败了,因为 pbxproj 文件将 CODE_SIGN_STYLE 设置为 Automatic。我想在不修改 pbxproj 文件的情况下实现构建,因为开发人员使用自动签名。

快速文件

        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")

在我们的 project.pbxproj 中我们有

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

也尝试了以下方法,但 gym/build_app 仍然没有选择匹配的环境变量:

            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 项目以使用特定的配置文件,或者更新 PROVISIONING_PROFILE_SPECIFIER调用前的值 build_app .

如果开发者只使用 Debug配置,您可以在 Debug 之间指定不同的设置和 Release .这样,您可以保留 Automatic Debug 的选项配置并为 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'"
)

https://stackoverflow.com/questions/70430700/

相关文章:

python - pandas mysql 如何使用 Dataframe 更新某些行列

c# - 在 Visual Studio 中替换后删除空行

java - ThreadPoolExecutor.shutdownNow() 没有在 Thread

python - 是否可以在 discord.py 中对不同的前缀使用不同的命令?

javascript - Typescript reducer 的 switch case type

reactjs - 如何在 React 中使用 map 输出嵌套对象的内容?

typescript - 数组中泛型的联合

ruby-on-rails - 无法使用 octokit 连接到 Github 帐户

android - 我们如何保存和恢复 Android StateFlow 的状态?

c++ - 无法构建 Boost Spirit 示例 conjure2