Contents

Sharing environment variables across Xcode Cloud workflows

Apply common configurations to multiple workflows by using shared environment variables.

Overview

You can use shared environment variables in your custom build scripts to extend workflows. For example, use a shared environment variable for the location of an IPA file. Then you can edit the values of common environment variables in one location.

Before you begin, configure your project to use Xcode Cloud and create two or more workflows to share environment variables with.

Manage shared environment variables in Xcode

To create shared environment variables in Xcode:

  1. Open your project, click the Report navigator button in the navigator bar, and then click the Cloud button.

  2. In the sidebar, Control-click your project name and choose Manage Environment Variables from the pop-up menu.

  3. In the lower-left corner of the sheet, click the Add button (+).

  4. In the Shared Environment Variables sheet, enter a name and value for the variable.

  5. To securely store the variable and make sure it doesn’t appear in any logs, select the “Keep value redacted” checkbox in the Secret section.

  6. To restrict editing of the alias to team roles, select the Only the Account Holder checkbox in the Restrict Editing section.

  7. Click Next.

  8. In the Select Workflows sheet, select the workflows you want to apply the environment variable to and then click Save.

  9. In the Shared Environment Variables sheet, click Done.

To edit or delete environment variables in the Shared Environment Variables sheet before you click Done, Control-click the variable, and then choose Edit or Delete.

To apply environment variables to workflows in Xcode:

  1. In the Report navigator, Control-click your project name and choose Manage Workflows from the pop-up menu.

  2. In the detail area of the sheet, Control-click the workflow you want to apply environment variables to, and then choose Edit from the pop-up menu.

  3. In the sidebar, click Environment.

  4. Under Environment Variables, select the environment variables to apply to the workflow.

  5. Click Save.

To create another environment variable, click the Add button and choose New Shared Environment Variable from the pop-up menu.

Manage shared environment variables in App Store Connect

You can also apply shared environment variables to workflows in App Store Connect with the following steps:

  1. Sign in to your App Store Connect account and go to your app’s page.

  2. Click the Xcode Cloud tab.

  3. In the sidebar, click Settings.

  4. Click the Shared Environment Variables tab.

  5. Next to Shared Environment Variables, click the Add button.

  6. In the New Shared Environment Variable sheet, enter a name and value for the variable.

  7. To securely store the variable and make sure it doesn’t appear in any logs, select the Secret checkbox.

  8. To restrict editing of the alias to team roles, select the Only the Account Holder checkbox.

  9. Click Next.

  10. In the Select Workflows sheet, select the workflows you want to apply the environment variable to.

  11. Click Save.

To edit or delete custom aliases, click More (…) next to the environment variable and choose Edit or Delete from the pop-up menu.

See Also

Setup and maintenance