Skip to main content

Using Ionic Appflow Services

1. Setting Up Appflow Account

Setting up an Ionic Appflow account is the first step to leveraging Ionic's powerful app management and deployment features.

Step Description Action
1. Visit Appflow Dashboard Go to the Ionic Appflow dashboard. https://dashboard.ionicframework.com
2. Sign In or Create Account Sign in with an existing account or create a new one using email, GitHub, or Google. Use the login interface on the dashboard.
3. Verify Email Check your email for a verification link if prompted. Click the verification link to confirm your email address.
4. Configure Appflow Settings Set up your organization and app preferences. Access the settings panel in the dashboard to configure options like notifications, integrations, and permissions.

Example: Appflow Account Setup

npm install -g @ionic/cli
ionic login
Note: Ensure you have an active internet connection and a valid email address to complete the setup process.

2. Connecting Git Repository

Step Description Action
1 Log in to Ionic Appflow dashboard Visit https://appflow.ionic.io and sign in with your Ionic account credentials.
2 Navigate to App Settings Go to the Settings tab of your app in the dashboard.
3 Select Git Integration Under App Configuration, find and click on the Git Integration section.
4 Connect Repository Choose your Git provider (GitHub, GitLab, Bitbucket) and select the repository you want to connect.
5 Configure Build Settings Set up build triggers and branch configurations for automatic builds.

Example: Connecting GitHub Repository

ionic appflow:git:connect \
  --app-id "your-app-id" \
  --provider github \
  --repo "your-username/your-repo"
Note: Ensure that your repository is public or that you have granted appropriate permissions for the Ionic Appflow service to access it.

3. Configuring Build Automations

Property Value Description
build.trigger auto or manual Set to auto to trigger builds on code push, manual to require manual trigger
build.branch main, develop, etc. Specify the Git branch to build from
build.environment production, staging Environment for the build (e.g., production, staging)
build.notification on-success, on-failure Notification settings for build status

Example: Build Configuration in Ionic Appflow

{
  "build": {
    "trigger": "auto",
    "branch": "main",
    "environment": "production",
    "notification": "on-success"
  }
}
Note: Build automations can be configured via the Ionic Appflow dashboard or using the CLI.

4. Creating Native Builds

Building native apps with Ionic Appflow involves compiling your web code into native binaries for iOS and Android platforms. This process is managed through the Appflow dashboard or CLI.

Build Type Description Requirements Status
iOS Native Build Compiles your app into a native iOS binary (.ipa) Xcode, Apple Developer Account NEW
Android Native Build Compiles your app into a native Android binary (.apk or .aab) Android SDK, Keystore NEW

Example: Triggering a Native Build via CLI

ionic appflow build --platform ios --channel production

Example: Building for Android

ionic appflow build --platform android --channel production
Note: Ensure your app's configuration in ionic.config.json is set up correctly for native builds.
Warning: Native builds require valid certificates and provisioning profiles for iOS.

5. Implementing Live Deploy

Live Deploy is a feature in Ionic Appflow that allows you to update your app's code without requiring users to download a new version from the app store.

Property Description Value
app.id Unique identifier for your app in Appflow com.example.myapp
deploy.channel Channel to deploy to (e.g., 'production', 'staging') production
deploy.release Release version to deploy (e.g., '1.0.0') 1.0.0

Example: Deploying with Ionic CLI

ionic deploy --app-id com.example.myapp --channel production --release 1.0.0
Note: Ensure that your app is configured to use the Appflow SDK for Live Deploy to function correctly.
Warning: Live Deploy updates are not available for all platforms. iOS requires additional configuration to support code updates.

6. Configuring Deploy Channels

Channel Description Usage
production Primary channel for production releases Used for deploying stable, user-facing builds
staging Pre-production channel for testing Used to validate updates before going live
development Channel for ongoing development builds Used for internal testing and feature development

Example: Setting up a new channel

ionic deploy channel create --name beta --description "Beta testing channel"
Note: Channels can be configured to auto-deploy builds when new code is pushed to a specific branch.

7. Managing Build Artifacts

Artifact Type Description Usage Notes
iOS IPA Apple iOS application package For distribution via App Store or TestFlight Requires valid Apple Developer account
Android APK Android application package For distribution via Google Play or sideloading Requires keystore configuration
Web Build Progressive Web App build For deployment to web servers or CDN Can be served directly from Ionic Appflow
Source Code Full source code archive For backup or migration purposes Compressed ZIP format

Example: Downloading Build Artifacts

# Download latest iOS build
ionic appflow build download --platform ios

# Download specific artifact by ID
ionic appflow build download --artifact-id 123456789
Note: Build artifacts are retained for 30 days by default in Ionic Appflow.
Warning: Ensure proper permissions are set when downloading artifacts to prevent unauthorized access.
Property Values Description
artifactId string Unique identifier for the artifact
platform ios, android, web Target platform of the build
status success, failed Build success or failure status
created ISO 8601 date string Timestamp of artifact creation

8. Setting Up Webhooks

Webhooks in Ionic Appflow allow you to automate workflows by triggering actions when specific events occur, such as a build completing or a release being published.

Event Description Webhook URL Triggered When
build.success Build completes successfully https://yourdomain.com/webhook/build-success Build finishes with status success
build.failure Build fails https://yourdomain.com/webhook/build-failure Build finishes with status failure
release.published Release is published to a channel https://yourdomain.com/webhook/release-published A release is published to a channel (e.g., production)

Example: Configuring a Webhook URL in Ionic Appflow

curl -X POST https://api.ionic.io/webhooks \
  -H "Authorization: Bearer <your-access-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourdomain.com/webhook/build-success",
    "event": "build.success"
  }'
Note: Ensure your webhook URL is accessible and secured to prevent unauthorized access.
Warning: Webhooks must be configured with a valid HTTPS endpoint to ensure secure communication.

9. Implementing CI/CD Pipelines

Example: Basic Ionic Appflow CI/CD Configuration

name: Ionic Appflow CI/CD
on:
  push:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '18'
      - name: Install Dependencies
        run: npm install
      - name: Build App
        run: npm run build
      - name: Deploy to Appflow
        uses: ionic-team/appflow-action@v1
        with:
          app-id: "your-app-id"
          token: ${{ secrets.APPFLOW_TOKEN }}
Step Description Configuration
Checkout Code Fetches the source code from the repository actions/checkout@v2
Setup Node.js Installs the required Node.js version actions/setup-node@v2
Install Dependencies Installs project dependencies using npm npm install
Build App Compiles the Ionic application npm run build
Deploy to Appflow Deploys the built app to Ionic Appflow ionic-team/appflow-action@v1
Note: Ensure that the APPFLOW_TOKEN is securely stored in your repository's secrets.
Warning: The Appflow deployment step requires a valid Ionic Appflow token with appropriate permissions.

Key CI/CD Pipeline Components

  • Source Code Management: Uses Git for version control and branching strategy.
  • Build Automation: Automates the build process using npm scripts.
  • Deployment: Integrates with Ionic Appflow for seamless deployment.

10. Monitoring Build Status

Property Description Values
build.status Current status of the build process pending, running, success, failed
build.id Unique identifier for the build string
build.timestamp Time when the build started ISO 8601 datetime string
build.duration Duration of the build in seconds number

Example: Fetching Build Status

const buildId = "build-12345";
const response = await fetch(`/api/builds/${buildId}/status`);
const buildStatus = await response.json();
console.log(buildStatus.status); // "success"
Note: Build status updates are available in real-time via WebSocket connections for live monitoring.

Build Status Overview

  • pending: Build queued but not started
  • running: Build currently in progress
  • success: Build completed successfully
  • failed: Build encountered an error

Was this article helpful?