You have already setup your app on Bitrise, and now you are ready to start to deploy the app to your users or QA. There might be several versions going out and it might cause you some headache if you cannot identify these versions easily. Why have conflicting merges and misunderstandings and long conversations on who did or didn't fix what or when... You can easily refer to the exact build on Bitrise if you get an error report from a tester. Differentiate the versions to know who uses which and to make sure everybody uses the up-to-date app! Use (semi)automated version control on Bitrise too! 🤓
In software versioning a typical version identifier consists of 3 numbers, divided by full stops, e.g.: 3.4.2 (major.minor.build) Numbers are generally assigned in increasing order and correspond to new developments in the software.
Versions should be tracked in git repository. You can set version numbers in Info.plist, and you can update them manually there too. It is advised to do set the major and minor numbers by hand to be able to manage versions as you can decide which is a bigger or a smaller update. As for the build numbers, in a CI/CD environment it is useful to update the build while the build is happening.
On Bitrise there are steps to do just that: Set Xcode Project Build Number for iOS and Set Android Manifest Version Code and Name for Android. These steps insert the build number into the info.plist. If you did track versions otherwise earlier, you can offset these numbers to your existing numbering, so you don't have to start it all over again.
Android 🤖
This is how it looks in reality for Android:
---
format_version: '4'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
app:
envs:
- opts:
is_expand: false
GRADLE_BUILD_FILE_PATH: build.gradle
- opts:
is_expand: false
GRADLEW_PATH: "./gradlew"
workflows:
deploy:
steps:
- [email protected]:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- [email protected]: {}
- [email protected]:
title: Do anything with Script step
- [email protected]: {}
- [email protected]:
inputs:
- manifest_file: "$BITRISE_SOURCE_DIR/app/AndroidManifest.xml"
- version_code_offset: '0'
- version_name: 1.0.0
- [email protected]:
inputs:
- gradle_file: "$GRADLE_BUILD_FILE_PATH"
- gradle_task: assembleRelease
- gradlew_path: "$GRADLEW_PATH"
- [email protected]: {}
- [email protected]: {}
Copy codeiOS 📱
... and for iOS:
---
format_version: '3'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
- [email protected]:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- [email protected]: {}
- [email protected]:
inputs:
- plist_path: "$BITRISE_SOURCE_DIR/greg/Info.plist"
- build_version_offset: '0'
- build_short_version_string: '1.0'
- [email protected]:
inputs:
- export_method: development
- configuration: Debug
- [email protected]:
inputs:
- export_method: app-store
- team_id: TeamID
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: greg.xcodeproj
- opts:
is_expand: false
BITRISE_SCHEME: greg
Copy codeHappy version counting! 🔢