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 Secret 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

There are two ways of configuring your Capacitor project with Capgo: automatic and manual.

Automatic mode

Enable it by running the following command with your CAPGO_TOKEN:

npx @capgo/cli init [CAPGO_TOKEN]

Manual mode

  1. Add the Capgo plugin to your packages

npm i @capgo/capacitor-updater

  1. Modify your Capacitor project by adding the following in your capacitor.config.json
  "plugins": {
      "CapacitorUpdater": {
          "autoUpdate": true,  
          "version": "1.0.0" // Bump this number each time you release a native version in the app store
      }
  }
  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:

  • upload your project to Capgo

Ensure you first install your dependencies and build your JS:

  scripts:
    - name: Update dependencies and copy web assets to native project
      script: | 
        npx cap sync
    - name: Upload to Capgo
      script: | 
        npx @capgo/cli bundle upload --a $CAPGO_TOKEN

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 bundle 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.