---
description: Learn how to automatically increment build numbers for your Android and iOS builds in Capawesome Cloud.
title: Auto-Increment Build Numbers - Capawesome
image: https://capawesome.io/docs/assets/images/social/cloud/native-builds/guides/auto-incrementing-build-numbers.png
---

[ Skip to content](#auto-increment-build-numbers) 

[ 🎉 Introducing **Capawesome Platform** — one platform for Live Updates, Native Builds, App Store Publishing, and Insider SDKs.](https://capawesome.io) 

* [  Formbricks ](/docs/plugins/formbricks/)
* [  Geocoder ](/docs/plugins/geocoder/)
* [  Google Sign-In ](/docs/plugins/google-sign-in/)
* [  libSQL ](/docs/plugins/libsql/)
* [  Live Update ](/docs/plugins/live-update/)
* [  Managed Configurations ](/docs/plugins/managed-configurations/)
* [  Media Session ](/docs/plugins/media-session/)
* [  ML Kit ](/docs/plugins/mlkit/)
* [  NFC ](/docs/plugins/nfc/)
* [  OAuth ](/docs/plugins/oauth/)
* [  Pedometer ](/docs/plugins/pedometer/)
* [  Photo Editor ](/docs/plugins/photo-editor/)
* [  PostHog ](/docs/plugins/posthog/)
* [  Printer ](/docs/plugins/printer/)
* [  Purchases ](/docs/plugins/purchases/)
* [  RealtimeKit ](/docs/plugins/realtimekit/)
* [  Screen Orientation ](/docs/plugins/screen-orientation/)
* [  Screenshot ](/docs/plugins/screenshot/)
* [  Secure Preferences ](/docs/plugins/secure-preferences/)
* [  Speech Recognition ](/docs/plugins/speech-recognition/)
* [  Speech Synthesis ](/docs/plugins/speech-synthesis/)
* [  Share Target ](/docs/plugins/share-target/)
* [  Square Mobile Payments ](/docs/plugins/square-mobile-payments/)
* [  SQLite ](/docs/plugins/sqlite/)
* [  Superwall ](/docs/plugins/superwall/)
* [  Torch ](/docs/plugins/torch/)
* [  Wifi ](/docs/plugins/wifi/)
* [  Zip ](/docs/plugins/zip/)
* [  Cloud ](/docs/cloud/)
* [  Live Updates ](/docs/cloud/live-updates/)
* Advanced
* Integrations
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Configuration ](/docs/cloud/native-builds/configuration/)
* [  Environments ](/docs/cloud/native-builds/environments/)
* Guides
* [  Override Java Version ](/docs/cloud/native-builds/guides/override-java-version/)
* [  Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/guides/custom-ios-provisioning-profiles/)
* [  Install APK on Android Device ](/docs/cloud/native-builds/guides/install-apk-on-android-device/)
* [  Install IPA on iOS Device ](/docs/cloud/native-builds/guides/install-ipa-on-ios-device/)
* [  Sample Projects ](/docs/cloud/native-builds/sample-projects/)
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  Automations ](/docs/cloud/automations/)
* [  Assist ](/docs/cloud/assist/)
* Account
* Organizations
* [  Organization and User Management ](/docs/cloud/organizations/memberships/)
* [  Single Sign-On (SSO) ](/docs/cloud/organizations/sso/)
* [  Teams ](/docs/cloud/organizations/teams/)
* [  Two-Factor Authentication ](/docs/cloud/organizations/two-factor-authentication/)
* [  Integrations ](/docs/cloud/integrations/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Pricing ](https://capawesome.io/pricing/)
* [  FAQ ](/docs/cloud/faq/)
* [  Support ](/docs/cloud/support/)
* [  Contributing ](/docs/contributing/)
* [  LLMs ](/docs/llms/)
* [  Insiders ](/docs/insiders/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/insiders/support/)
* [  FAQ ](/docs/insiders/faq/)
* [  Blog ](/blog/)
* Categories

# Auto-Increment Build Numbers[¶](#auto-increment-build-numbers "Permanent link")

Capawesome Cloud provides automatic build number incrementing through the `CI_BUILD_NUMBER` environment variable, which increments with each build. This guide shows you how to automatically apply this build number to your native Android and iOS projects.

## Prerequisites[¶](#prerequisites "Permanent link")

This guide assumes you have already set up Trapeze for native configurations. If you haven't done this yet, follow the [Overwrite Native Configurations](/docs/cloud/native-builds/guides/native-configurations/) guide first to:

1. Install Trapeze
2. Set up the build script in your `package.json`

## Configuration[¶](#configuration "Permanent link")

Create a configuration file named `capawesome.yml` in the root of your project with the following content:

`[](#%5F%5Fcodelineno-0-1)vars:
[](#%5F%5Fcodelineno-0-2)  CI_BUILD_NUMBER:
[](#%5F%5Fcodelineno-0-3)    default: 1
[](#%5F%5Fcodelineno-0-4)
[](#%5F%5Fcodelineno-0-5)platforms:
[](#%5F%5Fcodelineno-0-6)  android:
[](#%5F%5Fcodelineno-0-7)    versionCode: $CI_BUILD_NUMBER
[](#%5F%5Fcodelineno-0-8)  ios:
[](#%5F%5Fcodelineno-0-9)    buildNumber: $CI_BUILD_NUMBER
`

This configuration maps the `CI_BUILD_NUMBER` environment variable to the version code on Android and the build number on iOS.

Default value 

The default value of `1` is used for local development when the `CI_BUILD_NUMBER` environment variable is not set. In Capawesome Cloud, this variable is automatically provided and increments with each build.

## How It Works[¶](#how-it-works "Permanent link")

When you trigger a build in Capawesome Cloud:

1. The `CI_BUILD_NUMBER` environment variable is automatically set to a sequential number
2. The [web build script](/docs/cloud/native-builds/guides/web-build-script/) runs Trapeze with your configuration
3. Trapeze updates the native project files with the current build number
4. Your app is built with the incremented build number

This ensures each build has a unique, incrementing build number without manual intervention.

## Custom Starting Number[¶](#custom-starting-number "Permanent link")

If you need to start incrementing from a specific number (for example, to continue from your current build number), you can set the next build number directly in the [app settings](https://console.cloud.capawesome.io/apps/%5F/settings). The next build number must be at least `1` higher than the previous build number, or `1` if no build has been created yet.

Alternatively, you can add an offset to the `CI_BUILD_NUMBER` variable in your build script:

`[](#%5F%5Fcodelineno-1-1){
[](#%5F%5Fcodelineno-1-2)  "scripts": {
[](#%5F%5Fcodelineno-1-3)    "capawesome:build": "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER + 1000)); if [ \"$CI_PLATFORM\" = \"ios\" ] || [ \"$CI_PLATFORM\" = \"android\" ]; then npx trapeze run capawesome.yml -y --$CI_PLATFORM; fi && npm run build"
[](#%5F%5Fcodelineno-1-4)  }
[](#%5F%5Fcodelineno-1-5)}
`

Replace `1000` with your desired offset. For example, if your current build number is 150 and you want the next build to be 151, use an offset of 150.

## Version Name and Build Number[¶](#version-name-and-build-number "Permanent link")

You can combine build number incrementing with version name management:

`[](#%5F%5Fcodelineno-2-1)vars:
[](#%5F%5Fcodelineno-2-2)  VERSION_NAME:
[](#%5F%5Fcodelineno-2-3)  CI_BUILD_NUMBER:
[](#%5F%5Fcodelineno-2-4)    default: 1
[](#%5F%5Fcodelineno-2-5)
[](#%5F%5Fcodelineno-2-6)platforms:
[](#%5F%5Fcodelineno-2-7)  android:
[](#%5F%5Fcodelineno-2-8)    versionName: $VERSION_NAME
[](#%5F%5Fcodelineno-2-9)    versionCode: $CI_BUILD_NUMBER
[](#%5F%5Fcodelineno-2-10)  ios:
[](#%5F%5Fcodelineno-2-11)    version: $VERSION_NAME
[](#%5F%5Fcodelineno-2-12)    buildNumber: $CI_BUILD_NUMBER
`

Then set the `VERSION_NAME` variable in your Capawesome Cloud environment (e.g., `1.0.0`). This way:

* The version name (e.g., `1.0.0`) remains consistent across builds
* The build number increments automatically with each build

March 11, 2026 

 Back to top 