xcode 如何在fastlane中设置环境变量?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48660640/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set environment variables in fastlane?
提问by Parth Adroja
I had read the documents but I am still confused where to set the environment variables in the fastfile or the bash_profile. Can you please help me out with that?
我已经阅读了文档,但我仍然对在 fastfile 或 bash_profile 中设置环境变量的位置感到困惑。你能帮我解决这个问题吗?
What I want to achieve is to set the apple developer credentials in fastfile and should not ask again if any user takes pull of my code and try to build it.
我想要实现的是在 fastfile 中设置苹果开发人员凭据,并且不应该再次询问是否有任何用户提取我的代码并尝试构建它。
I am writing this in fastlane file. Let me know if I am wrong.
我在 fastlane 文件中写这个。如果我错了,请告诉我。
default_platform(:ios)
platform :ios do
ENV["FASTLANE_DONT_STORE_PASSWORD"] = "1"
ENV["FASTLANE_USER"] = ""
ENV["FASTLANE_PASSWORD"] = ""
desc "GENERATE SCREENSHOT"
lane :Snaps do
capture_screenshots
end
end
回答by Bilal
You can add environment variables in before_all
. Try this.
您可以在before_all
. 尝试这个。
platform :ios do
before_all do
ENV["FASTLANE_DONT_STORE_PASSWORD"] = "1"
ENV["FASTLANE_USER"] = ""
ENV["FASTLANE_PASSWORD"] = ""
end
desc "GENERATE SCREENSHOT"
lane :Snaps do
capture_screenshots
end
end
To not store your keys in git, you can pass all parameters of all actions using environment variables.
为了不在 git 中存储您的密钥,您可以使用环境变量传递所有操作的所有参数。
You can edit your ~/.bash_profile
to include something like
您可以编辑您的内容~/.bash_profile
以包含类似的内容
export FASTLANE_DONT_STORE_PASSWORD ="1"
export FASTLANE_USER =""
export FASTLANE_PASSWORD =""