How to Access Xcode Cloud Workflow Environment Variables?

  Kiến thức lập trình

I’m running a custom workflow on Xcode Cloud. The workflow is failing at the Build step because it could not find my .env file. This sounds logical since I’m not pushing my .env file; it is not being tracked by git even.

I have already setup my custom environment variables on the Xcode Cloud workflow.

I can dynamically create the .env file in my ci_post_clone.sh script. Like:

// Like for instance on Github Actions, I could read my repository secrets like so.
// ${{secrets.MY_ENV_VAR}}

echo ${{secrets.MY_ENV_VAR}} >> .env
echo ${{secrets.MY_SECOND_ENV_VAR}} >> .env

How can I access Xcode workflow environment variables just like I’m accessing the Github secrets? I need a solution to read these variables from my custom ci_post_clone.sh script.

LEAVE A COMMENT