如何在fastlane fastfile中使用gitlab CI环境变量?

问题描述 投票:0回答:1

我目前正在使用.env文件来获取FASTFILE中的环境变量,但现在我正尝试使用GitLab CI / CD来使快速通道自动化。

由于具有所有键的.env文件无法被推送到分支,因此我必须在GitLab运行程序的环境变量中声明所有.env或环境变量。

我想知道如何在我的快速文件中使用GitLab运行程序的环境变量。

 lane :build_staging do |options|
    environment_variable(set: { 'ENVFILE' => '.env.staging' }) // I want to use the GitLab environment variable
    clean
    gradle(task: options[:task], build_type: 'Staging', project_dir: 'android/')

  end
gitlab gitlab-ci-runner fastlane
1个回答
0
投票
enter image description here

在您的gitlab-ci中,您可以通过在工作中使用$ENV_FILE关键字指定变量名(在我的示例中为stage)和范围来使用它:

build: stage: stagging script: # do you work here

您可以在文档中找到有关file类型和scope的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.