# Cloud Build Recipes - Incrementing Build Numbers

DevFeed: [Cloud Build Recipes - Incrementing Build Numbers](<https://devfeed.tech/articles/cloud-build-recipes-incrementing-build-numbers-30591.md>)

Original publisher: [Read original article](<https://ryanharter.com/blog/2019/01/cloud-build-recipes-incrementing-build-numbers/>)

Published: 2019-02-01T03:00:00Z

Content type: tutorial

Language: en

Sources: [Blogs on Ryan Harter](<https://devfeed.tech/sources/blogs-on-ryan-harter.md>)

Topics: [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Android](<https://devfeed.tech/topics/android.md>), [Bash](<https://devfeed.tech/topics/bash.md>), [Environment Variables](<https://devfeed.tech/topics/environment-variables.md>), [Disk image](<https://devfeed.tech/topics/disk-image.md>), [Dockerfile](<https://devfeed.tech/topics/dockerfile.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bash](<https://devfeed.tech/tags/bash.md>), [ci](<https://devfeed.tech/tags/ci.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cloud-storage](<https://devfeed.tech/tags/cloud-storage.md>), [docker](<https://devfeed.tech/tags/docker.md>), [environment-variables](<https://devfeed.tech/tags/environment-variables.md>)

## AI overview

A tutorial explains how to recreate incrementing CI build numbers in Google Cloud Build for Android app versioning. It uses a shared configuration folder, a text file, and Bash scripts to pass the updated number between isolated build steps, with an optional Docker container for deployment.

## Source excerpt

Many CI services use an incrementing build number to identify builds. GCB, however, uses a randomly assigned unique identifier, as is common in large scale systems. While this is common and helps make GCB infinitely scalable, it makes it difficult to reason about the relationship between builds. Since I like to use the CI build number in my Android app versioning, I decided to reimplement this functionality using a simple script and text file stored in a shared location. The idea is simple, each build mounts a shared config folder, reads the version number from a text file, and overwrites that text file with a new version number.