cli-tools icon indicating copy to clipboard operation
cli-tools copied to clipboard

Remove existing builds from review with `publish`

Open kevmo314 opened this issue 2 years ago • 4 comments

Is it possible to remove any pending builds from review with the publish command? We end up having a decent number of builds get rejected because there's already a build pending for review which makes our testflight not match the latest version.

kevmo314 avatar Nov 26 '22 19:11 kevmo314

This would be similar to fastlane's reject_if_possible: http://docs.fastlane.tools/actions/upload_to_app_store/#upload_to_app_store

or expire_previous_builds for testflight: https://docs.fastlane.tools/actions/pilot/

kevmo314 avatar Nov 26 '22 19:11 kevmo314

Hi @kevmo314, thanks for bringing this up. This sure sounds like a useful addition to app-store-connect publish. We'll give it some more thought on how to implement it and let you know. But please note that as of now I'm not yet able to give any ETA for it.

priitlatt avatar Nov 28 '22 09:11 priitlatt

@kevmo314

Hi! :)

Good proposal. However, to understand the aims and goals better, based on your description, it seems that the more fitting extension would be equivalent to Fastlane's reject_build_waiting_for_review instead of expire_previous_builds.

Please correct me if I am missing something. Thanks! :)

VeArnold avatar Nov 29 '22 08:11 VeArnold

Yeah that's probably correct. We run publish as our last CI/CD step right now and it fails due to an existing build being in review (both testflight and app store) so the ideal behavior would be to be able to unmark the older builds

kevmo314 avatar Nov 29 '22 15:11 kevmo314

Hi @kevmo314!

This got slightly delayed but has now been merged in #289.

For Codemagic CLI tools users The following actions:

  • app-store-connect builds submit-to-app-store - docs
  • app-store-connect publish - docs

now accept the flag --cancel-previous-submissions.

The flag acts the same as fastlane's reject_if_possible. Where before submission, there's an attempt to cancel any previous submission for the application that is in any of the following states: WAITING_FOR_REVIEW, IN_REVIEW or UNRESOLVED_ISSUES.

The following actions:

  • app-store-connect builds submit-to-testflight - docs
  • app-store-connect publish - docs

now accept the flag --expire-build-submitted-for-review.

The flag acts similarly to fastlane's reject_build_waiting_for_review; however, a build both in status IN_REVIEW, and WAITING_FOR_REVIEW is expired, as in both cases further submissions are blocked.

Alternatively, these actions (which are used within the flags) can be called directly for a specific application as well, such as:

  • app-store-connect apps expire-build-submitted-for-review <app-id> - docs
  • app-store-connect apps cancel-review-submissions <app-id> - docs

When using the flag, the blocking build or submission will be expired/cancelled if in a state where it is possible. For cancel-review-submissions, within the action itself, it is possible to target more specifically what you wish to cancel, e.g., specify the platform or state to cancel; see docs. Note that an expired build will no longer be available for testers.

For Codemagic CI/CD users This option was also added for Codemagic CI/CD users using the codemagic.yaml configuration. The relevant examples have been added to the documentation.

For submitting to Testflight, the publishing section has to be updated as follows:

publishing:
  app_store_connect:
    submit_to_testflight: true
    expire_build_submitted_for_review: true

And for App Store, as follows:

publishing:
  app_store_connect:
    submit_to_app_store: true
    cancel_previous_submissions: true

Along with these, some other actions were introduced with the PR, which can be seen in the changelog. Thanks again for the feedback and request! :) Please try it out, and let us know if you encounter any unexpected behaviour.

VeArnold avatar Feb 06 '23 09:02 VeArnold