@@ -23,6 +23,7 @@ def self.setup_constants(platform)
2323 end
2424 end
2525
26+ # rubocop:disable Metrics/PerceivedComplexity
2627 def self . run ( params )
2728 platform = params [ :platform ] || Actions . lane_context [ Actions ::SharedValues ::PLATFORM_NAME ]
2829 Helper ::GitHelper . setup_git_user
@@ -35,6 +36,8 @@ def self.run(params)
3536 Helper ::GitHelper . unfreeze_release_branch ( branch , platform , params [ :github_token ] )
3637 rescue StandardError => e
3738 Helper ::GitHubActionsHelper . set_output ( "stop_workflow" , true )
39+ Helper ::DdgAppleAutomationHelper . report_error ( e )
40+ UI . important ( "Failed to unfreeze release branch. Cannot proceed with the public release. Please unfreeze manually and run the workflow again." )
3841 task_id = AsanaExtractTaskIdAction . run ( task_url : params [ :asana_task_url ] )
3942 AsanaReportFailedWorkflowAction . run (
4043 asana_access_token : params [ :asana_access_token ] ,
@@ -46,8 +49,6 @@ def self.run(params)
4649 workflow_name : "Tag Release" ,
4750 workflow_url : ENV . fetch ( "WORKFLOW_URL" , nil )
4851 )
49- UI . important ( "Failed to unfreeze release branch. Cannot proceed with the public release. Please unfreeze manually and run the workflow again." )
50- Helper ::DdgAppleAutomationHelper . report_error ( e )
5152 return
5253 end
5354 end
@@ -58,35 +59,35 @@ def self.run(params)
5859 return
5960 end
6061
61- # if should_merge_before_deleting(params)
62- # begin
63- # branch = other_action.git_branch
64- # # merge the branch (not the tag) to the base branch first to have untagged commits in the base branch
65- # UI.important("Merging branch before deleting to have untagged commits in the base branch")
66- # Helper::GitHelper.merge_branch(@constants[:repo_name], branch, params[:base_branch], params[:github_elevated_permissions_token] || params[:github_token])
67- # rescue StandardError => e
68- # report_merge_release_branch_before_deleting_failed(params.values.merge(branch: branch))
69- # UI.important("Merging release branch to base branch failed. Cannot proceed with the public release. Please merge manually and run the workflow again.")
70- # Helper::GitHubActionsHelper.set_output("stop_workflow", true)
71- # Helper::DdgAppleAutomationHelper.report_error(e)
72- # return
73- # end
74- # end
75-
76- # tag_and_release_output = create_tag_and_github_release(params[:is_prerelease], platform, params[:github_token])
77- # Helper::GitHubActionsHelper.set_output("tag", tag_and_release_output[:tag])
78-
79- # if tag_and_release_output[:tag_created]
80- # begin
81- # merge_or_delete_branch(params.values.merge(tag: tag_and_release_output[:tag]))
82- # tag_and_release_output[:merge_or_delete_successful] = true
83- # rescue StandardError => e
84- # tag_and_release_output[:merge_or_delete_successful] = false
85- # Helper::DdgAppleAutomationHelper.report_error(e)
86- # end
87- # end
88-
89- # report_status(params.values.merge(tag_and_release_output))
62+ if should_merge_before_deleting ( params )
63+ begin
64+ branch = other_action . git_branch
65+ # merge the branch (not the tag) to the base branch first to have untagged commits in the base branch
66+ UI . important ( "Merging branch before deleting to have untagged commits in the base branch" )
67+ Helper ::GitHelper . merge_branch ( @constants [ :repo_name ] , branch , params [ :base_branch ] , params [ :github_elevated_permissions_token ] || params [ :github_token ] )
68+ rescue StandardError => e
69+ report_merge_release_branch_before_deleting_failed ( params . values . merge ( branch : branch ) )
70+ UI . important ( "Merging release branch to base branch failed. Cannot proceed with the public release. Please merge manually and run the workflow again." )
71+ Helper ::GitHubActionsHelper . set_output ( "stop_workflow" , true )
72+ Helper ::DdgAppleAutomationHelper . report_error ( e )
73+ return
74+ end
75+ end
76+
77+ tag_and_release_output = create_tag_and_github_release ( params [ :is_prerelease ] , platform , params [ :github_token ] )
78+ Helper ::GitHubActionsHelper . set_output ( "tag" , tag_and_release_output [ :tag ] )
79+
80+ if tag_and_release_output [ :tag_created ]
81+ begin
82+ merge_or_delete_branch ( params . values . merge ( tag : tag_and_release_output [ :tag ] ) )
83+ tag_and_release_output [ :merge_or_delete_successful ] = true
84+ rescue StandardError => e
85+ tag_and_release_output [ :merge_or_delete_successful ] = false
86+ Helper ::DdgAppleAutomationHelper . report_error ( e )
87+ end
88+ end
89+
90+ report_status ( params . values . merge ( tag_and_release_output ) )
9091 end
9192
9293 def self . should_merge_before_deleting ( params )
@@ -109,6 +110,7 @@ def self.assert_branch_tagged_before_public_release(params)
109110 end
110111 true
111112 end
113+ # rubocop:enable Metrics/PerceivedComplexity
112114
113115 def self . create_tag_and_github_release ( is_prerelease , platform , github_token )
114116 tag , promoted_tag = Helper ::DdgAppleAutomationHelper . compute_tag ( is_prerelease , platform )
0 commit comments