← Back to home

How to increment the app version on CI

When working on CI/CD tooling, I often want for a machine to make changes to the git repo.

I’ll run with one example. Let’s say you would like for a CD machine to bump a version number when your app is being deployed, commit it and push upstream. It might be tricky to do so when you have branch protection enabled. Automatically opening a pull request to bump a version seems like an overkill.

Instead of making changes to the repo, consider generating a manifest file with the version number in it, and deploy it together with your application. With the next deployment, fetch that file, bump the version, and upload a new manifest. The key is to make sure manifest file is always reachable at the same URL.

In case you manually bumped the version in the repo, your tooling can pick the highest version number between the manifest file and the committed one.

I found this trick to work very reliably, without any complains from the team.

Last edited on Jul 11, 2019