Building and Releasing
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Releasing an Ionic app means releasing two native apps that happen to contain the same web bundle. The web part is
built once with the Angular CLI; each platform then wraps it in its own signed, store-ready artefact. This page
walks the pipeline for Trailhead (com.example.trailhead) on Capacitor 8.6.0, Ionic Framework 9.0.10 and
Angular 22.2.5: a production web build, npx cap sync, an Android App Bundle for Google Play, an iOS archive
for TestFlight and the App Store, versioning, continuous integration, and the optional shortcut of updating the web
bundle over the air. Native toolchain minimums for Capacitor 8 are Node 22+, Xcode 26.0+ and Android Studio Otter
2025.2.1+ (AGP 8.13.0, Gradle 8.14.3, Kotlin 2.2.20).
Read Platform Integration first for the native projects, and Testing for the checks that gate a release. The section starts at Hybrid Apps.
The Release Pipeline
Production Web Build
npm ci
npx ng build --configuration production
npx cap sync
The Angular production configuration enables optimisation, hashing and ahead-of-time compilation. The output folder
must equal webDir in capacitor.config.ts, otherwise cap sync copies an old or empty bundle. Always rebuild the
web app before every native build; the native projects do not do it for you.
Environments and Configuration
The bundle is public, so configuration is build-time and contains no secrets. Angular file replacements or environment files select the API base URL per build:
// src/environments/environment.ts (development)
export const environment = {
production: false,
apiBase: 'https://staging-api.example.com/v1',
};
// src/environments/environment.prod.ts
export const environment = {
production: true,
apiBase: 'https://api.example.com/v1',
};
Make sure server.url (live reload) is absent from the config used for release builds. Keep signing keys and
service credentials out of the repository and in the CI secret store.
Versioning
Each store tracks a user-visible version and a monotonically increasing build number.
| Platform | Marketing version | Build number |
|---|---|---|
Android |
|
|
iOS |
|
|
// android/app/build.gradle.kts (or build.gradle in Groovy projects)
android {
defaultConfig {
applicationId = "com.example.trailhead"
versionCode = 14
versionName = "1.4.0"
}
}
Keep both platforms on the same marketing version and derive the build number from the CI run number so uploads never collide.
Android
Signing
Google Play requires every release to be signed. Create an upload keystore once and guard it:
keytool -genkeypair -v -keystore trailhead-upload.jks -alias upload \
-keyalg RSA -keysize 2048 -validity 10000
Reference it from Gradle through properties supplied by CI, never hard-coded:
android {
signingConfigs {
create("release") {
// file() resolves a relative path against android/app/
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "trailhead-upload.jks")
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = "upload"
keyPassword = System.getenv("KEY_PASSWORD")
}
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
}
}
}
With Play App Signing, Google holds the final app signing key and you keep only the upload key, which can be reset if lost.
Building
cd android
./gradlew bundleRelease # AAB for Google Play: app/build/outputs/bundle/release
./gradlew assembleRelease # APK for direct distribution and testing
Upload the .aab to a Play Console track: internal testing first, then closed or open testing, then production
with a staged rollout. Complete the store listing, the Data safety form and the content rating before the first
production release. New apps must target a recent API level; Capacitor 8 projects target 36.
iOS
-
Open the workspace with
npx cap open ios. -
In Signing & Capabilities select your team and enable automatic signing, or supply a distribution certificate and provisioning profile for CI.
-
Set the version and build number on the App target.
-
Choose Any iOS Device and run Product > Archive.
-
In the Organizer, Distribute App and select App Store Connect to upload.
The same steps can be run from the command line on a Mac:
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Release \
-archivePath build/Trailhead.xcarchive archive
xcodebuild -exportArchive -archivePath build/Trailhead.xcarchive \
-exportOptionsPlist ExportOptions.plist -exportPath build/export
Use -workspace ios/App/App.xcworkspace instead of -project when the project uses CocoaPods. Uploaded builds
appear in TestFlight after processing; add internal testers, then external testers (which needs Beta App Review).
In App Store Connect, attach a build to the app version, fill in privacy details (including the usage descriptions
your plugins required), screenshots and release notes, then submit for review.
Continuous Integration with GitHub Actions
Android builds run on Linux, iOS builds need a macOS runner.
name: release
on:
push:
tags: ['v*']
jobs:
android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- run: npm ci
- run: npx ng build --configuration production
- run: npx cap sync android
- name: Decode keystore
run: echo "$KEYSTORE_B64" | base64 --decode > android/app/trailhead-upload.jks
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
- run: cd android && ./gradlew bundleRelease
env:
KEYSTORE_PATH: trailhead-upload.jks
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- uses: actions/upload-artifact@v4
with:
name: aab
path: android/app/build/outputs/bundle/release/*.aab
ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx ng build --configuration production
- run: npx cap sync ios
# Import the distribution certificate and profile from secrets,
# then archive and export with xcodebuild as shown above.
Pin the runner image and action versions to what your organisation has approved, and make sure the Xcode version on the runner satisfies the Capacitor 8 minimum (Xcode 26.0). Store credentials as repository or environment secrets, never in the workflow file. Fastlane is a common alternative for the signing and upload steps on both platforms.
Live Updates (Over-the-Air Web Bundle Updates)
Because the app’s UI is a web bundle, it is technically possible to deliver a new bundle without a store release. Two options exist:
-
Capacitor Live Updates (
@capacitor/live-updates0.5.0, still a pre-1.0 package) is the first-party integration from the Ionic team; it works with a hosted update service and is configured through theplugins.LiveUpdatesblock. -
Capawesome Live Update is a commercial service with its own Capacitor plugin and channel-based rollout.
-
Self-hosted approaches exist but require you to build download, integrity checking and rollback yourself.
import { LiveUpdates } from '@capacitor/live-updates';
export async function checkForUpdate(): Promise<void> {
const result = await LiveUpdates.sync();
if (result.activeApplicationPathChanged) {
await LiveUpdates.reload();
}
}
Check each provider’s documentation for the exact API of the version you install; the call above shows the shape, not a contract. Rules that apply regardless of provider:
-
Only the web layer can change. Native code, plugins, permissions and manifest entries still need a store release, and a bundle that expects a newer native API must not be delivered to old binaries.
-
Apple and Google both restrict downloaded code that changes an app’s primary purpose or bypasses review. Use live updates for fixes and small improvements, and read the current store guidelines before relying on them.
-
Always keep a rollback path and roll out gradually.
Ionic Appflow was the vendor’s hosted build and live-update service. Its availability and terms have changed over time, so check the current vendor status before planning around it.
Release Checklist
| Step | Check |
|---|---|
Version |
Marketing version and build numbers bumped on both platforms |
Web |
Production build, |
Native |
|
Signing |
Keystore and distribution certificate available to CI |
Testing |
Unit, Playwright and a smoke test on a real device |
Stores |
Listing, privacy forms and screenshots complete |
See also Ionic Cheat Sheet, Hybrid Apps: IDEs & Tools, React Native for its own release story, and Media Optimization for shrinking assets before they reach the bundle.