skills/codemagic-ci-cd-onboarding/SKILL.md
Guide a user from zero to the first successful mobile build (APK/IPA) with Codemagic for Flutter or React Native.
npx skillsauth add codemagic-ci-cd/codemagic-skills codemagic-ci-cd-onboardingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Codemagic is a mobile-first CI/CD platform optimized for Flutter and React Native.
This skill guides the user from initial setup to a first successful build artifact using Codemagic, handling setup inline and resolving common blockers.
Use when:
Use especially when:
Reach a first successful build (APK for Android or IPA for iOS) without breaking the flow.
Onboarding is complete when:
a Codemagic build finishes successfully, and
a valid artifact is produced:
codemagic.yaml as source of truthRead before executing the flow. These apply to all project types.
cd between scripts does not persist.
Each script block runs in its own subshell. Always combine dependent commands (cd android && ./gradlew assembleDebug) into a single script block. Environment variables set in one script are also not available in the next — define them under environment.
local.properties must be generated, not committed.
Use echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/android/local.properties" — $ANDROID_SDK_ROOT is a built-in Codemagic env var. Do not hardcode the path.
File name is codemagic.yaml, not codemagic.yml.
If the file is misnamed, Codemagic will not detect it. Check during validation.
Expo: android/ may not exist in the repo.
Run expo prebuild before the Gradle step. Confirm the generated android/ directory is accessible in the build environment for this workflow.
If no Codemagic account → instruct user to create/login
If repo is not connected → guide to connect Git provider (GitHub/GitLab/Bitbucket), confirm Codemagic has access
Decision: account missing → create → continue / repo not connected → connect → continue
Detect:
pubspec.yamlpackage.json + ios/ and/or android/app.json or app.config.js with Expo SDKIf unclear: inspect repo structure, ask 1 clarifying question if needed, then proceed.
If user says the app is already added → verify the correct repo is connected, then skip to Step 3.
Do not proceed to build before this is complete.
codemagic.yaml exists (root)Validate:
codemagic.yaml (not .yml)instance_type is not set — omitting it routes the build to the free-tier instance, which is correct for first-build validation; do not add or suggest a valuecd across separate blocks (see Critical notes)If missing → create from templates below. If partially valid (e.g. exists but contains only unrelated workflows) → add a new workflow for the current project type; do not remove existing workflows. If invalid → fix, then continue.
Tip: Codemagic provides a JSON schema for IDE validation — useful when editing locally: https://docs.codemagic.io/yaml-basic-configuration/yaml-getting-started/#validating-codemagic-yaml
workflows:
flutter-build:
name: Flutter Build
max_build_duration: 30 # recommended to avoid consuming free-tier quota on hung builds
environment:
flutter: stable
scripts:
- name: Get dependencies
script: flutter pub get
- name: Build APK
script: flutter build apk
artifacts:
- build/**/outputs/**/*.apk
workflows:
rn-android-build:
name: React Native Android
max_build_duration: 30 # recommended to avoid consuming free-tier quota on hung builds
environment:
node: latest
scripts:
- name: Install dependencies
script: npm install
- name: Set Android SDK location
script: echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/android/local.properties"
- name: Build debug APK
script: cd android && ./gradlew assembleDebug
artifacts:
- android/app/build/outputs/**/*.apk
workflows:
expo-android-build:
name: Expo Android
max_build_duration: 30 # recommended to avoid consuming free-tier quota on hung builds
environment:
node: latest
scripts:
- name: Install dependencies
script: npm install
- name: Run Expo prebuild
script: npx expo prebuild --platform android --non-interactive
- name: Set Android SDK location
script: echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/android/local.properties"
- name: Build debug APK
script: cd android && ./gradlew assembleDebug
artifacts:
- android/app/build/outputs/**/*.apk
After committing codemagic.yaml:
If detection fails: verify file name (
codemagic.yaml) and location (repo root).
Expect: dependency install succeeds → build step runs → artifact generated
If build succeeds → go to Step 9.
For automatic builds, two things are required:
1. Add triggering to codemagic.yaml:
triggering:
events:
- push
- pull_request
2. Set up a webhook:
Without a configured webhook,
triggering:in the yaml has no effect.
Do not block flow on this step.
pubspec.yaml missing → invalid project, cannot proceedflutter pub get fails → fix dependenciesandroid/ → verify project structurelocal.properties missing → generate via echo "sdk.dir=$ANDROID_SDK_ROOT" script (see Critical notes)cd not persisting → merge into single script blockandroid/ → run expo prebuild --platform android --non-interactive before Gradle stepandroid/ was generated and is accessible in the build environment for this workflowlocal.properties and cd rules applylocal.properties generation scriptAdd a minimal iOS workflow when the user targets iOS or requests an IPA:
workflows:
ios-build:
name: iOS Build
max_build_duration: 30
environment:
flutter: stable # remove if React Native
xcode: latest
cocoapods: default
scripts:
- name: Get dependencies
script: flutter pub get # replace with `npm install` for React Native
- name: Build unsigned IPA
script: |
flutter build ios --release --no-codesign
# For React Native: xcodebuild -workspace ios/App.xcworkspace \
# -scheme App -configuration Release \
# -sdk iphoneos -archivePath build/App.xcarchive archive
artifacts:
- build/ios/iphoneos/*.app
Signing is required for a distributable IPA. If certs/profiles are missing, inform the user and ask whether to continue with iOS signing setup or validate first with an Android build. Do not assume a preference.
Rule: fixable automatically → fix / external or manual → explain + next step + continue where possible.
Never stop at "configure this first" or "come back later."
Always: apply fix → retry build → proceed.
Stop only when build succeeds or a hard external blocker is confirmed.
Switch to:
codemagic-flutter-deploycodemagic-build-androidcodemagic-build-ioscodemagic-publish-google-playcodemagic-publish-app-storecodemagic-ios-code-signing-fixcodemagic-android-signing-fixtools
Configure and operate Codemagic-hosted CodePush for React Native iOS and Android apps, including native plugin wiring, deployment key/server URL setup, Codemagic CI integration, and OTA release lifecycle (release, promote, patch, rollback). Use when requests mention CodePush, codepush, OTA updates, @code-push-next/react-native-code-push, @codemagic/code-push-cli, codepush.pro, deployment keys, or staged iOS/Android rollout workflows.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.