Codemagic
A variable group that lets every store-build workflow register its build, and a workflow on push to main that releases every merge, both in codemagic.yaml.
To ship every commit from Codemagic, codemagic.yaml carries two parts. Every store-build workflow imports a variable group holding HOTCODEPUSH_TOKEN, so the build step registers the store build. A workflow on every push to main releases the over-the-air (OTA) update.
Ship every commit has the prerequisites and the three disciplines. This page carries the codemagic.yaml workflows.
Secrets to set
Both live under the app's Environment variables tab or the team's Global variables and secrets, Secret on, each in a group imported under environment.groups. Nothing goes under vars, which is committed with the file.
Two groups keep the key out of the store builds:
| Group | Variable | Holds |
|---|---|---|
hotcodepush | HOTCODEPUSH_TOKEN | Holds an API token from the console's API tokens page. |
hotcodepush_signing | HOTCODEPUSH_SIGNING_KEY | Holds the content of the private key file signing-key create wrote, PEM lines included. Leave the group and its - hotcodepush_signing line out until the app has a key. |
Codemagic does not document how it treats a pull request from a fork. In a repository that takes outside contributions, keep both groups out of every workflow on pull_request.
The pipeline
Codemagic starts a codemagic.yaml workflow through the repository's webhook. Create webhook in the app settings adds it.
The store builds
Add the token's group to each existing store-build workflow, iOS and Android:
workflows:
ios-store-build:
environment:
groups:
- hotcodepushThe build step that init added runs binary create. Codemagic sets CI, so it fails without the token. The default images ship Node.js 22 or later, and a workflow pinned to xcode: 16.0 adds node: lts.
Before ./gradlew or xcode-project build-ipa:
| Framework | Before the native build |
|---|---|
| React Native | npm ci |
| Expo | npm ci, then npx expo prebuild, which applies the config plugin |
| Capacitor | npm ci, npm run build, npx cap sync |
| Cordova | npm ci, then cordova platform add, which installs the plugin's build step |
Two quick starts need a change:
- The Expo quick start moves
support-files/build.gradleoverandroid/app/build.gradleafter the prebuild, which drops the Gradle line the config plugin wrote. Copy the support file from a prebuild that ran the plugin. - The Capacitor quick start on Swift Package Manager has no iOS workspace:
xcode-project build-ipa --project ios/App/App.xcodeproj --scheme App. Its Android workflow setsjava: 21.
The OTA release
workflows:
ota-release:
name: Release to production
instance_type: mac_mini_m2
environment:
groups:
- hotcodepush
- hotcodepush_signing
triggering:
events:
- push
branch_patterns:
- pattern: main
include: true
scripts:
- name: Install dependencies
script: npm ci
- name: Build the web app
script: npm run build
- name: Release to production
script: npx hotcodepush release create --channel production --bundle-version "$(git rev-parse --short HEAD)" --git-ref "$CM_BRANCH" --yes --json- A React Native or Expo app drops the
npm run buildstep: the CLI packages the bundle per platform inside the upload. A Cordova app whosewwwis written by hand drops it too. - Codemagic does not document whether the clone is on the branch, so
--git-ref "$CM_BRANCH"records it. release lists every flag.
A failed command fails the step with the CLI's exit code and prints the error as JSON, and the error catalog names the fix. A green build and a device that did not take the release is the other case. See Troubleshooting.
A preview channel per pull request runs from another workflow on pull_request. Test with preview channels has the commands. Codemagic runs no workflow when a pull request closes, so give the channel an expiry.
What stays separate
- OTA services: Codemagic's own are CodePush by Codemagic and Codemagic Patch. Each needs its own SDK in the app, so an app on HotCodePush uses neither. An app leaving Patch follows Migrate from Codemagic Patch. Codemagic runs the builds and the release line, and the update comes from HotCodePush.
- Billing: Codemagic bills its own plans, and HotCodePush bills by monthly active devices (Billing and MAU).
Next steps
- Ship every commit names the three disciplines a pipeline that ships every commit keeps.
- Test with preview channels builds the tester build that follows a preview channel from the QR code.
- Roll out gradually puts
--rollout-percent 10 --progressionon the release line and explains the counters behind auto-pause.
Last updated on
Capawesome Cloud
Tag builds that register the store build with HotCodePush and a web build on main that releases every merge, both as Capawesome Cloud automations.
EAS Build
Store builds on EAS Build that register themselves with HotCodePush through an EAS secret, and an EAS Workflows job that releases every push to main.