Environment variables

I have the following step and I’d like to set some environment variables that are accessible from the fastlane script.

- name: Create build via Fastlane
        env:
            DEVELOPER_DIR: /Applications/Xcode_11.2.1.app/Contents/Developer
MY_VAR: SomeVal
        run: sudo fastlane build --verbose

I’ve tried setting the variable in the env part but in the script it’s nil.  I’ve also tried exporting the environment variable in another step but it’s still nil.  What am I missing?

After you add your variables under jobs.<job_id>.steps.env, you can use $DEVELOPER_DIR and $MY_VAR in your script to use their value.

Please see my example:

developer_dir.png