This feature is only available on our Scale plan. Please contact us to enable this feature.
It is possible to trigger Deploy builds on Appflow directly from the CLI. This is extremely useful if you need to integrate the Deploy build step inside an existing external CI/CD process.
Upgrade the Ionic CLI to at least version
To use environments, a proper Appflow subscription that allows the usage of Automations is needed.
The Ionic CLI has to be authenticated on Appflow to be able to trigger a Deploy build.
To log in, type:
This will prompt for the Appflow username/password.
The CLI can also be authenticated via an environment variable (for example, if it is used during a CI/CD task).
To set up the authentication via environment variable, first login via the CLI with an Appflow user who has access to the app you want to trigger Deploy builds for:
Then, export the authentication token:
Finally, export the token in an environment variable of your shell or your CI/CD service.
Your app must be linked to the remote app on Appflow. If the app is not linked yet, run:
and commit the changes to
Currently, a Deploy build can be triggered only from the root project directory:
Assuming the CLI is authenticated, to trigger a Deploy build, run:
Once the build is successfully triggered, the CLI will automatically start tailing the logs from Appflow.
The Options available to customize the build include:
--environment=<name>to specify the group of environment variables to be exposed to the build (available only with Automation; more info about environments are available here)
--channel=<name>to specify the channel you want to auto deploy the build to. This can be repeated multiple times if multiple channels need to be specified; more infos about channels are available here
The Advanced Options available to customize the build include:
--commit=<sha1>The commit defaults to HEAD; to use a different commit you can use this option with the full SHA1 of the commit.
Names are case sensitive and need to be specified including spaces, for instance:
Apart from the
--commit option, all others require the full name setup within the Appflow Dashboard.
Look for the name on the Environments and Destinations pages in Appflow: