Search code examples
bitrise

Is there a way to assign the output of a step to another environment variable on Bitrise?


The Xcode archive step creates this variable: ${BITRISE_DEPLOY_DIR} and read that pilot uses the PILOT_IPA environment variables for the IPA directory.

Is there a way to assign the output (BITRISE_DEPLOY_DIR) to another environment variable (e.g.: $PILOT_IPA)?


Solution

  • You can do that by using envman (https://github.com/bitrise-io/envman) which is part of the bitrise CLI tool stack.

    To assign the value of an existing Environment Variable (Step outputs are just regular Environment Variables) you can use a Script step, and specify this as the content:

    #!/bin/bash
    
    echo "BITRISE_DEPLOY_DIR: $BITRISE_DEPLOY_DIR"
    envman add --key PILOT_IPA --value "$BITRISE_DEPLOY_DIR"
    

    This'll first print the value of the BITRISE_DEPLOY_DIR environment variable, and then with envman add it'll add a new environment item with the key PILOT_IPA and the value of $BITRISE_DEPLOY_DIR.