---
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/auto-incrementing-build-numbers.png
---

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

[ 🔐 Introducing the **Capacitor Vault** plugin — store secrets behind biometrics or a device passcode.](/blog/announcing-the-capacitor-vault-plugin/) 

* [  SDKs ](/docs/sdks/)
* [  Formbricks ](/docs/sdks/capacitor/formbricks/)
* [  Geocoder ](/docs/sdks/capacitor/geocoder/)
* [  Google Sign-In ](/docs/sdks/capacitor/google-sign-in/)
* [  Grafana Faro ](/docs/sdks/capacitor/grafana-faro/)
* [  libSQL ](/docs/sdks/capacitor/libsql/)
* [  Live Update ](/docs/sdks/capacitor/live-update/)
* [  Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [  Media Session ](/docs/sdks/capacitor/media-session/)
* [  ML Kit ](/docs/sdks/capacitor/mlkit/)
* [  Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [  NFC ](/docs/sdks/capacitor/nfc/)
* [  OAuth ](/docs/sdks/capacitor/oauth/)
* [  Pedometer ](/docs/sdks/capacitor/pedometer/)
* [  Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [  PostHog ](/docs/sdks/capacitor/posthog/)
* [  Printer ](/docs/sdks/capacitor/printer/)
* [  Purchases ](/docs/sdks/capacitor/purchases/)
* [  RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [  Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [  Screenshot ](/docs/sdks/capacitor/screenshot/)
* [  Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [  Speech Recognition ](/docs/sdks/capacitor/speech-recognition/)
* [  Speech Synthesis ](/docs/sdks/capacitor/speech-synthesis/)
* [  Share Target ](/docs/sdks/capacitor/share-target/)
* [  Square Mobile Payments ](/docs/sdks/capacitor/square-mobile-payments/)
* [  SQLite ](/docs/sdks/capacitor/sqlite/)
* [  Superwall ](/docs/sdks/capacitor/superwall/)
* [  Torch ](/docs/sdks/capacitor/torch/)
* [  Vault ](/docs/sdks/capacitor/vault/)
* [  Wifi ](/docs/sdks/capacitor/wifi/)
* [  Zip ](/docs/sdks/capacitor/zip/)
* [  Cordova ](/docs/sdks/cordova/)
* [  Cloud ](/docs/cloud/)
* [  Integrations ](/docs/cloud/live-updates/integrations/)
* Concepts
* Reference
* [  Troubleshooting ](/docs/cloud/live-updates/troubleshooting/)
* [  FAQ ](/docs/cloud/live-updates/faq/)
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Set Up Environments ](/docs/cloud/native-builds/environments/)
* [  Overwrite Native Configurations ](/docs/cloud/native-builds/native-configurations/)
* Auto-Increment Build Numbers [  Auto-Increment Build Numbers ](/docs/cloud/native-builds/auto-incrementing-build-numbers/)
* [  Configure the Web Build Script ](/docs/cloud/native-builds/web-build-script/)
* [  Build from a Monorepo ](/docs/cloud/native-builds/monorepo/)
* [  Use pnpm or Yarn ](/docs/cloud/native-builds/package-managers/)
* [  Install Private npm Packages ](/docs/cloud/native-builds/npm-private-registry/)
* [  Override the Java Version ](/docs/cloud/native-builds/override-java-version/)
* [  Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/custom-ios-provisioning-profiles/)
* [  Build without Git ](/docs/cloud/native-builds/build-without-git/)
* [  Access Git Behind a Firewall ](/docs/cloud/native-builds/firewall-access/)
* [  Integrations ](/docs/cloud/native-builds/integrations/)
* Reference
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  FAQ ](/docs/cloud/native-builds/faq/)
* [  App Store Publishing ](/docs/cloud/app-store-publishing/)
* [  Submit a Build ](/docs/cloud/app-store-publishing/submit-a-build/)
* [  Submit Automatically After a Build ](/docs/cloud/app-store-publishing/submit-automatically/)
* [  Troubleshooting ](/docs/cloud/app-store-publishing/troubleshooting/)
* [  FAQ ](/docs/cloud/app-store-publishing/faq/)
* [  Automations ](/docs/cloud/automations/)
* [  Reference ](/docs/cloud/automations/reference/)
* [  Troubleshooting ](/docs/cloud/automations/troubleshooting/)
* [  FAQ ](/docs/cloud/automations/faq/)
* [  Assist ](/docs/cloud/assist/)
* [  CLI ](/docs/cloud/cli/)
* APIs and SDKs
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Integrations ](/docs/cloud/integrations/)
* Account
* [  Organization ](/docs/cloud/organizations/)
* [  Two-Factor Enforcement ](/docs/cloud/organizations/two-factor-authentication/)
* [  Audit Logs ](/docs/cloud/organizations/audit-logs/)
* [  Billing ](/docs/cloud/organizations/billing/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  AI ](/docs/ai/)
* [  Insiders ](/docs/insiders/)
* [  Billing & Plans ](/docs/insiders/billing-and-plans/)
* [  FAQ ](/docs/insiders/faq/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/support/)
* [  Contributing ](/docs/contributing/)
* Contributing code
* [  Code of Conduct ](/docs/contributing/code-of-conduct/)
* [  Questions ](https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion#creating-a-discussion)
* [  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/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/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 