Skip to content

Commit 30a6efe

Browse files
committed
📝 Add more detailed example to perform_version_bump
1 parent 7745199 commit 30a6efe

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

git_utils.cfg

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ GIT_ALLOW_PUSH_TO_MASTER=false
1111
# @param $1 version name to update to.
1212
# @param $2 root directory of project.
1313
perform_version_bump() {
14-
# Save the version number in a config file called 'example'.
14+
# Save the version number in an example config file...
1515
echo "$1" > "$2/example.cfg"
1616

17+
# ...Or perhaps you'd like to edit an iOS Info.plist?
18+
local currVersion=defaults read "$2/Info.plist" 'CFBundleVersion'
19+
defaults write "$2/Info.plist" 'CFBundleVersion' -string "${currVersion}"
20+
defaults write "$2/Info.plist" 'CFBundleShortVersionString' -string "$1"
21+
22+
# ...Or an Android Gradle config?
23+
gsed -r 's/(.*)(versionName )(.*)/echo "\1\2\\"$1\\""/ge' "$2/build.gradle"
24+
gsed -r 's/(.*)(versionCode )([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' "$2/build.gradle"
25+
1726
# Commit the change.
18-
git add "${config_file}"
27+
git add "$2/{example.cfg, Info.plist, build.gradle}"
1928
git commit -m ":gem: Bump version to $1" -m "Auto-change using build script v${BUILD_SCRIPT_VERSION}."
2029
}

0 commit comments

Comments
 (0)