And the flow would be: after the lane has finished, check if it was a debug lane or not, so we create a proper message and a download link for Debug and Beta builds, create the hash to be sent to Slack, do the required git changhes and clean all artifacts except the mobileprovision files. If the lane failed, revert the version and clean.

The git handling method looks like this:

def commit_tag_and_update_release_branch
Actions.sh 'git add .'
Actions.sh "git commit -am \"Version Bump to #{version_number}\""
Actions.sh "git tag -a #{version_number} -m \"Version #{version_number} submitted to the App Store\""
# Earlier we already set ensure_git_branch to development, unless we used the :release_quick_fix lane
# So we know we either are on the development branch, or on a quick-fix one, so it's safe to push and pull-request
Actions.sh "git push origin #{current_branch}:#{current_branch}"
Actions.sh "git pull-request -m \"Merging #{version_number}\" -b development -h release"
end

It commits the version bump we did earlier with increase_version, tags the commit with the version_number, pushes the branch and opens a pull request (with the help of hub, a command line wrapper for GitHub).