Skip to content

Commit 0c41097

Browse files
committed
Add merge_release_to_main lane
1 parent d12163e commit 0c41097

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

fastlane/Fastfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ lane :publish_release do |options|
100100
update_spm(version: options[:version])
101101
end
102102

103+
lane :merge_release_to_main do
104+
ensure_git_status_clean
105+
sh('git checkout main')
106+
sh('git pull')
107+
108+
# Grep all remote release branches and ensure there's only one
109+
release_branches = sh(command: 'git branch -a', log: false).delete(' ').split("\n").grep(%r(origin/.*release/))
110+
UI.user_error!("Expected 1 release branch, found #{release_branches.size}") if release_branches.size != 1
111+
112+
# Merge release branch to main. For more info, read: https://notion.so/iOS-Branching-Strategy-37c10127dc26493e937769d44b1d6d9a
113+
sh("git merge #{release_branches.first} --ff-only")
114+
UI.user_error!('Not pushing changes') unless prompt(text: 'Will push changes. All looking good?', boolean: true)
115+
sh('git push')
116+
UI.important('Please, wait for the `Publish new release` workflow to pass on GitHub Actions: ' \
117+
"https://github.com/#{github_repo}/actions/workflows/publish-release.yml")
118+
end
119+
103120
private_lane :appstore_api_key do
104121
@appstore_api_key ||= app_store_connect_api_key(
105122
key_id: 'MT3PRT8TB7',

0 commit comments

Comments
 (0)