File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,19 @@ perform_version_bump() {
15
15
echo " $1 " > " $2 /example.cfg"
16
16
17
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 "
18
+ local iosConfig=" $2 /ios/Info.plist"
19
+ local currVersion=" $( defaults read " ${iosConfig} " ' CFBundleVersion' ) "
20
+ defaults write " ${iosConfig} " ' CFBundleVersion' -string " $(( ${currVersion} + 1 )) "
21
+ defaults write " ${iosConfig} " ' CFBundleShortVersionString' -string " $1 "
22
+ plutil -convert xml1 " ${iosConfig} " # Convert plist back to XML.
21
23
22
24
# ...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
+ local androidConfig=" $2 /android/build.gradle"
26
+ export TEMP=$1 # Make it global in order to expose this var to `sed`
27
+ gsed -ri ' s/(.*)(versionName )(.*)/echo "\1\2\\"${TEMP}\\""/ge' " ${androidConfig} "
28
+ gsed -ri ' s/(.*)(versionCode )([0-9]+)(.*)/echo "\1\2$((\3 + 1))\4"/ge' " ${androidConfig} "
25
29
26
30
# Commit the change.
27
- git add " $2 /{ example.cfg, Info.plist, build.gradle }"
31
+ git add " $2 /example.cfg" " ${iosConfig} " " ${androidConfig }"
28
32
git commit -m " :gem: Bump version to $1 " -m " Auto-change using build script v${BUILD_SCRIPT_VERSION} ."
29
33
}
You can’t perform that action at this time.
0 commit comments