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

Generating a CodePush Access Token.

Follow these steps to generate a permanent CodePush access token:

  1. Navigate to your Profile Settings page. Locate the CodePush Tokens section.

  2. Click Authenticate to complete the one-time authentication process for your account.

Authenticate

  1. Once authenticated, click Generate Token to create a new access token.

Generate Token

  1. Leave the expiration date empty to create a non-expiring token. Then click Generate.

Generate

  1. Copy the generated token which donot have any expire date and store it securely. This token can be used in your CI/CD pipelines without needing renewal.

Copy

Finding App Names for CodePush (Android & iOS)

To list all the apps registered to your CodePush account, run the following command:

Terminal
appsonair-codepush app ls

This will display a list of available apps.

Identify and note down the app name you want to use for CodePush deployment. (Both Android and iOS)

CI/CD Environment Variables

Add the following secrets or environment variables to your CI/CD settings to enable seamless deployment with CodePush:

Variable NameDescription
APPS_ON_AIR_TOKENYour personal access token generated from AppsOnAir
APP_NAME_ANDROIDYour Android app deployment name in AppsOnAir
APP_NAME_IOSYour iOS app deployment name in AppsOnAir

Make sure these values are kept secure and are not committed to version control.


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 > Profile Settings > CodePush Tokens
Update not showing on deviceVersion mismatchEnsure -t matches app version installed on user devices