April 6, 2023
  • All
  • Product
  • Appflow

Managing build environments in Appflow

Cecelia Martinez

Developer Advocate

Configuring and managing build environments is critical in mobile development, but keeping everything organized can feel like a job even Marie Kondo couldn’t handle. Without build environments, ensuring you have the right tools in place to successfully build your app is cumbersome at best. One wrong configuration value and your build pipeline can come to a screeching halt.

A build environment is essentially the collection of dependencies and configurations needed to build your app. Now multiply that by each platform, version, and delivery channel, and you have a lot of environments to manage. Fortunately Appflow, Ionic’s mobile DevOps solution, is designed for easily managing build environments to ensure your app is built and deployed consistently across all platforms.

Appflow manages the dependencies for you by providing build stacks and provides multiple options for easily specifying configuration details.

Custom Environments

Mobile teams will typically have multiple versions of their application, such as for testing or internal use, as well as for each supported platform like iOS and Android. Each of these versions will have different configurations, such as:

  • API endpoints
  • Version code, name, or number
  • Bundle identifier
  • API keys or other credentials

These are typically managed with environment variables and secret keys that are set for each specific build environment. Managing these manually can be difficult, but Appflow lets you define and store custom environments to streamline and simplify your automated builds.

To create a custom environment, go to Build > Environments. Give your environment a name and provide key/value pairs for secret keys and environment variables for that environment. Keep in mind that secret keys cannot be viewed once set.

Once created, you can choose a custom environment from the Builds or Automations screen to make variables and secret keys available during build time. The environments can be updated at any time, allowing for security best practices such as key rotation.

iOS Schemes and Android Variants

Appflow custom environments are particularly powerful when combined with Appflow’s iOS Schemes and Android Variants support. Use the `IOS_SCHEME`, `ANDROID_BUILD_TYPE`, and `ANDROID_FLAVOR` environment variables to use a scheme or variant defined in your project, and Appflow will apply it during the build. This means you won’t have to duplicate configurations you’ve already defined in your Android or iOS project.

Read more about schemes and variants here.

Native Configurations

For specific configuration overrides such as the app name or bundle ID, or to customize variables for Appflow Live Updates, you can also leverage built-in custom native configurations. Just like custom environments, native configurations can be defined and selectively applied at build time for native iOS and Android builds.

Ad-Hoc Environments

While predefined custom environments make it easy to manage build environments for your most common build types, sometimes you need flexibility for a single build. This is helpful when testing new environment changes before adding them to your regular workflow or for unique one-off changes.

To support this nimble workflow, Appflow introduced Ad-Hoc Environments that allow you to set or override environment variables for a single build. From the build screen, you can pass key/value pairs which apply to that specific build only. These values are not saved after the build, and it’s not recommended to use sensitive data.

If you’d like to create and save a new custom environment from the build screen, use the Environment section.

Get Started

Appflow custom environments and ad-hoc environments are now available for all Appflow plans. To leverage them for your mobile deployments, sign up for a free account today and start building. If you have any questions about getting started, our team is here to help.


Cecelia Martinez

Developer Advocate