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 Secure option is selected.
Click the Add button to add the variable.
Add the variable group to your
codemagic.yaml
fileenvironment: groups: - capgo_credentials
Configure your project
- Modify your Capacitor project by adding the following in your capacitor.config.json
"plugins": {
"CapacitorUpdater": {
"autoUpdate": true
}
}
- 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.