Skip to main content

Deploy a Live Update on Appflow using the Ionic CLI

caution

Following previous deprecation announcements, Appflow functionality has been removed from the Ionic CLI. Please visit our migration guide for further details on migrating to Ionic Cloud CLI.

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.

Prerequisites

Upgrade the Ionic CLI to at least version 4.8.0.

To use environments, a proper Appflow subscription that allows the usage of Automations is needed.

Authentication

The Ionic CLI has to be authenticated on Appflow to be able to trigger a Deploy build.

To log in, create a Personal Access Token on the Appflow Dashboard.

then type:

$ export IONIC_TOKEN=<your personal access token>

Your app must be linked to the remote app on Appflow. If the app is not linked yet, run:

$ ionic link <app id>

and commit the changes to ionic.config.json.

Trigger a deploy build

Currently, a Deploy build can be triggered only from the root project directory:

$ cd /path/to/your/app

Assuming the CLI is authenticated, to trigger a Deploy build, run:

$ ionic deploy build

Once the build is successfully triggered, the CLI will automatically start tailing the logs from Appflow.

Customize the Deploy build with Options

The Options available to customize the build include:

  • --environment=<name> to specify the group of environment variables to be exposed to the build (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

Customize the Deploy build with Advanced Options

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.

Note about referencing Options values by name

Names are case-sensitive and need to be specified including spaces, for instance:

$ ionic deploy build --channel="My Custom Channel"

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:

CLI Environments List CLI Channels List

Contact Us