Skip to main content

Integration via CI/CD Pipeline

This section explains how to automate CodePush deployments using a CI/CD pipeline. By integrating CodePush into your CI/CD workflow (e.g., GitHub Actions, GitLab CI), you can ensure that every new release is automatically pushed to users without manual intervention.


Prerequisites

Before setting up automated deployments to AppsOnAir CodePush, ensure:

  • AppsOnAir account and project set up
  • Your app integrated with the AppsOnAir CodePush Depployment Key and ServerURL
  • Your CI/CD system supports Node.js and shell scripts (e.g., GitHub Actions, GitLab CI)

Environment Variables

In your CI/CD settings, define the following secrets or environment variables:

Variable NameDescription
APPS_ON_AIR_TOKENYour personal access token
APP_NAME_ANDROIDYour Android app deployment name in AppsOnAir
APP_NAME_IOSYour iOS app deployment name in AppsOnAir
  • You can get the access token by using command appsonair-codepush login, this will redirect to a webpage where you will be able to generate access token.

  • To find the app names (for Android and iOS), run:

Terminal
appsonair-codepush app ls

This will list all apps registered to your account.


CI/CD Workflow Setup

.github/workflows/codepush.yml
name: CodePush

on:
push:
branches:
- main

jobs:
codepush:
runs-on: ubuntu-latest

env:
APPS_ON_AIR_TOKEN: ${{ secrets.APPS_ON_AIR_TOKEN }}
APP_NAME_ANDROID: ${{ secrets.APP_NAME_ANDROID }}
APP_NAME_IOS: ${{ secrets.APP_NAME_IOS }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18" # Or your preferred version

- name: Install AppsOnAir CLI
run: npm install -g @appsonair/codepush-cli

- name: Authenticate with AppsOnAir
run: appsonair-codepush login --accessKey $APPS_ON_AIR_TOKEN

- name: Install project dependencies
run: npm install

- name: Deploy CodePush - iOS
run: appsonair-codepush release-react $APP_NAME_IOS

- name: Deploy CodePush - Android
run: appsonair-codepush release-react $APP_NAME_ANDROID

Trobleshooting

IssueCauseFix
Error: Missing app nameApp name not passed or invalidMake sure APP_NAME_ANDROID / APP_NAME_IOS are set correctly
Invalid access tokenExpired or incorrect tokenRegenerate from AppsOnAir > Account > CodePush > Access Token
Update not showing on deviceVersion mismatchEnsure -t matches app version installed on user devices