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:
Sign up with Capgo to get your login token
Open your Codemagic app settings, and go to the Environment variables tab.
Enter the desired Variable name, e.g.
CAPGO_TOKEN.Copy and paste the Capgo token string as Variable value.
Enter the variable group name, e.g. capgo_credentials. Click the button to create the group.
Make sure the Secret option is selected.
Click the Add button to add the variable.
Add the variable group to your
codemagic.yamlfileenvironment: 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
- Add the Capgo plugin to your packages
npm i @capgo/capacitor-updater
- 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
}
}- 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_TOKENWhen 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 productionAs 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.