November 18, 2022
  • Announcements
  • Appflow
  • CLI
  • Cloud

Support added for Live Update native versioning in Ionic Cloud CLI

Cecelia Martinez

Developer Advocate

Appflow, the mobile DevOps platform from Ionic, lets teams push certain app changes instantly with the Live Update feature. The Appflow dashboard provides functionality to restrict these live updates to certain versions of your native application. Now, this native versioning feature is also available in the Ionic Cloud CLI so you can easily update from your existing CI/CD pipeline.

Live updates with appflow

Live Updates from Appflow provide the ability to update the HTML, CSS, and JavaScript of mobile applications without app store approval or a native version update. With Live Updates, release critical bug fixes, UI updates, or business logic changes as soon as they’re ready for your users.

The Live Update feature works by installing the Live Update SDK in your native application and assigning a specific channel. Then, when a web build is assigned that channel, the app will listen for these updates and deploy them within your existing native app. A live update web build can be initiated from the Appflow dashboard or via Automation, or using the Ionic Cloud CLI.

Native versioning

A key feature of live updates is designating a minimum, maximum, and/or equivalent version of your native app to restrict the live update. This controls when updates happen based on the native version to ensure that only binary compatible changes are deployed to your app. Previously, native versioning a live update web build was only available in the Appflow dashboard. You can see full instructions on how to update native version restrictions in the dashboard here.

Now, the new Ionic Cloud CLI command means teams can automate the entire live update from their existing CI/CD platform of choice.

Appflow flexibility with the Ionic Cloud CLI

The Ionic Cloud CLI allows teams using their own CI/CD platforms to have granular control of Appflow features like builds, deploys, and live updates. Rather than setting up automations using the Appflow dashboard, you can use the CLI to control exactly when builds are produced and deployed and customize any steps between.

Appflow has added a new live-update set-native-versions command to the Ionic Cloud CLI to set the minimum, maximum, or equivalent iOS and Android versions for a given live update build ID and app ID.

Setting native version restrictions from your pipeline

To use the new command, pass the required build ID and app ID, as well as the flags for the platform and version restriction type. 

Example:

ionic-cloud live-update set-native-versions --app-id=b3456cd --build-id=baf924a --ios-min=1.2.3 --android-min=1.2.3

Setting a minimum means the native binary must be at least this version in order to download the update, while maximum requires the app to be at that version or below. Setting an equivalent means that apps with that native binary version will not download the live update because they are equal.

Native version numbers must follow the NPM semver standard, such as 1.0.5. Appflow will not properly handle version numbers that are invalid, such as those with leading zeros before a digit (1.0.05). 

If you are running this command in your pipeline after the build step, you can dynamically pass the build ID by saving the output of the build command as a variable.

Example:

BUILDID=$(ionic-cloud build web --app-id=b3456cd --commit=a9eb85e --json  | jq -r '.buildId')

ionic-cloud live-update set-native-versions --app-id=b3456cd --build-id=$(BUILDID) --ios-min=1.2.3 --android-min=1.2.3

Once you’ve set the native version restriction, you can also deploy your live update from the Ionic Cloud CLI with the `deploy web` command.

Example:

ionic-cloud deploy web --app-id=b3456cd --build-id=baf924a --destination="Production"

For more information on the Ionic Cloud CLI and available commands, check out the documentation here. The Ionic Cloud CLI is available for Appflow Standard and Enterprise accounts. If you’re not using Appflow yet for automated native builds and deployments, you can start a free trial today.


Cecelia Martinez

Developer Advocate