codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
243 stars 42 forks source link

Getting the latest build number across ALL versions #320

Open orenagiv opened 1 year ago

orenagiv commented 1 year ago

Hey,

Currently it seems this tool fetches the latest build number of the highest version number. However, when dealing with hot fixes - we sometimes need to create a build in a lower version than the newest one.

Is there a way to instruct the tool to fetch the latest build number across all versions? (and not only from the highest one?)

helinanever commented 1 year ago

Hi @orenagiv ,

Thank you for reporting this issue. Can you tell us from what service you were trying to get the latest build number? Please provide the exact commands you were using as well as a description of actual vs expected behavior.

sebimarkgraf commented 1 year ago

I am probably facing the same issue as orenagiv. This is Apple specific as for Android the build versions are globally unique, while for Apple distributions every version can have their own build numbers.

Simple case: For the App we already build Version 2.0.0 with e.g. build number 5 but did not publish it yet, as the app is not final.

We had released 1.9.0 but now need to develop a quick fix 1.9.1 for some security issue.

When using appstoreconnect, we always going to receive 5 for the latest build number, as 2.0.0 > 1.9.1. Then the simple build number + 1 logic, is always going to return 6, which is not the version we want. As soon as we need two build numbers for our 1.9.1 release, they are going to both have the version 6 and fail to upload.

Possible fix: Allow the user to specify the version which should be checked for the latest build number. Here, we could hand the public version (1.9.1 | 2.0.0) and receive the correct build number and increment it.

The exact command I am currently using $(app-store-connect get-latest-build-number "$APP_ID")

sebimarkgraf commented 1 year ago

Update mainly for @orenagiv : A possible supported way for the scenario seems to be get-latest-testflight-build-number which supports --pre-release-version to query a specific version.