I am using fastlane to automate my deployments to the play store. Here is a alpha lane as an example.
lane :alpha do
gradle(task: 'clean')
gradle(
task: 'assemble',
build_type: 'Release',
properties: {
"android.injected.signing.store.file" => ENV["ANDROID_KEYSTORE"],
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["ANDROID_KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["ANDROID_KEY_PASSWORD"],
}
)
upload_to_play_store(track: 'alpha')
end
I want to automate this deployment with Github actions. Whenever a commit to staging
occurs, run fastlane alpha
. The issue I am running into, however, is versioning. I need to bump the versionCode
in my build.gradle
file. I have been doing this manually before running fastlane alpha
.
I want to remove the need to bump this value manually before I commit, how can I achieve this?
I have seen this fastlane plugin to increment the version code. If I, for example, commit once while the versionCode is at 1, then my workflow will automatically increment the versionCode
to 2. When I commit again, the versionCode
will still be 1, and Github will bump it to 2. However, the play store needs versionCode
3. The ideal solution is to have Github query from the Google Play Store the current versionCode
of my app and supply that + 1
to fastlane. I have searched for a way to do this but cannot find a solution.