Skip to content

Commit 37bcfd5

Browse files
authored
[Tooling] Allow finalize_release lane to be retried on CI (#13195)
2 parents 5622867 + 2a3544f commit 37bcfd5

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

fastlane/Fastfile

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -519,25 +519,31 @@ platform :ios do
519519

520520
# Wrap up
521521
version = release_version_current
522-
remove_branch_protection(
523-
repository: GITHUB_REPO,
524-
branch: "release/#{version}"
525-
)
526-
set_milestone_frozen_marker(
527-
repository: GITHUB_REPO,
528-
milestone: version,
529-
freeze: false
530-
)
531-
create_new_milestone(
532-
repository: GITHUB_REPO,
533-
need_appstore_submission: true,
534-
milestone_duration: 7,
535-
number_of_days_from_code_freeze_to_release: 10
536-
)
537-
close_milestone(
538-
repository: GITHUB_REPO,
539-
milestone: version
540-
)
522+
begin
523+
remove_branch_protection(
524+
repository: GITHUB_REPO,
525+
branch: "release/#{version}"
526+
)
527+
set_milestone_frozen_marker(
528+
repository: GITHUB_REPO,
529+
milestone: version,
530+
freeze: false
531+
)
532+
close_milestone(
533+
repository: GITHUB_REPO,
534+
milestone: version
535+
)
536+
rescue StandardError => e
537+
error_message = <<-MESSAGE
538+
Error removing branch protection or finalization of milestone `#{version}`: #{e.message}
539+
- If this is a retry of the lane, the milestone might have already been closed and this error is expected.
540+
Just ensure the branch protection for `release/#{version}` is no more and that the milestone `#{version}` is indeed closed.
541+
- If this is the first run of the lane, please investigate the error.
542+
MESSAGE
543+
544+
UI.error(error_message)
545+
buildkite_annotate(style: 'warning', context: 'finalize-release-error-milestone', message: error_message) if is_ci
546+
end
541547

542548
# Start the build
543549
UI.important('Pushing changes to remote and triggering the release build')

0 commit comments

Comments
 (0)