Capgo integration

How to integrate your workflows with Capgo using codemagic.yaml

Capgo allows you to deploy live updates for Capacitor apps after they have been published to the App Store or Google Play.

A sample project that shows how to configure Capgo integration is available in our Sample projects repository.

Configuring Capgo in Codemagic

Configure environment variables

In order to get live updates in your Capgo account via Codemagic, you need to complete the following steps:

  1. Sign up with Capgo to get your login token

  2. Open your Codemagic app settings, and go to the Environment variables tab.

  3. Enter the desired Variable name, e.g. CAPGO_TOKEN.

  4. Copy and paste the Capgo token string as Variable value.

  5. Enter the variable group name, e.g. capgo_credentials. Click the button to create the group.

  6. Make sure the Secure option is selected.

  7. Click the Add button to add the variable.

  8. Add the variable group to your codemagic.yaml file

      environment:
        groups:
          - capgo_credentials

Configure your project

  1. Modify your Capacitor project by adding the following in your capacitor.config.json
  "plugins": {
      "CapacitorUpdater": {
          "autoUpdate": true
      }
  }
  1. Inside your main app file (index.tsx), import the following package:
import { CapacitorUpdater } from '@capgo/capacitor-updater'

CapacitorUpdater.notifyAppReady()

Configure codemagic.yaml

Add the following scripts to your codemagic.yaml file to:

  • install the capacitor-updater
  • update dependencies and copy assets to native project
  • upload your project to Capgo
  scripts:
    - name: Install npm dependencies for Ionic project
      script: | 
        npm install @capgo/capacitor-updater
        npx @capgo/cli login $CAPGO_TOKEN
    - name: Update dependencies and copy web assets to native project
      script: | 
        npx cap sync
    - name: Upload to Capgo
      script: | 
        npx @capgo/cli add 
        npx @capgo/cli upload

When uploading app versions to Capgo, executing the following command will submit updates to all users (if production channel is set to public):

  npx @capgo/cli@latest upload -c production

As soon as users start installing app versions on their devices, a device list will be visible in the Capgo UI. You can choose any one of them in order to let specific groups of users know about updates shipped with version uploads.