Package builds on Appflow using the Ionic CLI
note
This feature is only available on our Scale plan. Please contact us to enable this feature.
It is possible to trigger Package builds on Appflow directly from the CLI. This is extremely useful if you need to integrate the Package build step as part of an existing external CI/CD process.
#
PrerequisitesUpgrade the Ionic CLI to at least version 4.7.0
.
To trigger Package builds on Appflow from the Ionic CLI, a proper subscription to run Package builds is needed.
To use Environments, a proper subscription that allows the usage of Automations is needed.
#
AuthenticationThe Ionic CLI has to be authenticated on Appflow to be able to trigger a Package build.
To login 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:
Prevent the CLI from invalidating the token:
Finally, export the token in an environment variable of your shell or your CI/CD service.
#
Link the appYour app must be linked to the remote app on Appflow. If the app is not linked yet, run:
and commit the changes to ionic.config.json
.
#
Trigger a package buildCurrently, Package builds can only be triggered from the root project directory:
Assuming the CLI is authenticated, to trigger a Package build, run:
This will prompt for the desired platform (ios
/android
) and build type for the platform.
For iOS or Android release
builds, a valid signing certificate is required and can be specified using the --signing-certificate=<name>
option.
For information on setting up signing certificates, see here.
The previous commands can be executed in a single step:
Once the build is successfully triggered, the CLI will automatically start tailing the logs from Appflow and, if the build is successful, download the apk
/ipa
file in the current directory.
#
Customize the package build with OptionsThe 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)--native-config=<name>
to specify the group of native config variables to be exposed to your build (more info about native configs are available here)
#
Customize the package build with Advanced OptionsThe 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--build-stack=<name>
This option is mostly useful for iOS builds if for any reason a package build with a specific version of Xcode is needed. If this is omitted the preferred version is used.--artifact-type
Specify which artifacts to download after a successful build. Options areapk
,ipa
,aab
anddsym
. Note: If this option is specified, unavailable artifacts will trigger an error code from the CLI.--build-file-name=<name>
(Deprecated v6.13) To override the downloaded file name use this option. This might be useful, for instance, in a CI build to have a consistent name for the produced artifact. Note: This will override onlyapk
oripa
on Android and iOS respectively.--apk-name=<name>
To override the Android apk downloaded file name--aab-name=<name>
To override the Android aab downloaded file--ipa-name=<name>
To override the iOS ipa downloaded file--dsym-name=<name>
To override the iOS dsym downloaded file
#
Note about referencing Options values by nameNames 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 signing certificate, Environments and Native Configs pages in Appflow:
For the build stack, use one of the strings identifying the platform in the Applflow Package Build form: