Created
November 9, 2019 12:26
-
-
Save arpitdsoni/e364b31d1fb1f9f565b94a86ab58992f to your computer and use it in GitHub Desktop.
develop branch as source of truth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Gets the build number from develop, returns incremented number" | |
lane :incremented_build_number do | |
# the truth for the current build number is on develop, switch branch and get the number | |
orig_git_branch = git_branch | |
sh("git checkout develop") | |
build_number = get_build_number.to_i + 1 | |
sh("git checkout #{orig_git_branch}") | |
build_number | |
end | |
desc "Increment build number" | |
lane :build_number_bump do | |
build_number = incremented_build_number | |
increment_build_number({build_number: build_number}) | |
end | |
desc "Use this carefully, it pushes the commit to git remote" | |
desc "Push build bump to both develop and current branch" | |
lane :commit_build_number_bump do | |
orig_git_branch = git_branch | |
commit_version_bump(message: "👊 Build bump #{version} #{get_build_number} [skip ci]", xcodeproj: mycfx_xcodeproj) | |
push_to_git_remote | |
if orig_git_branch == "develop" | |
next | |
end | |
sh("git checkout develop") | |
# cherry pick (--strategy-option theirs forces to accept the change coming in over what is already here) | |
sh("git cherry-pick #{orig_git_branch} --strategy-option theirs") | |
push_to_git_remote | |
sh("git checkout #{orig_git_branch}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment