-
Notifications
You must be signed in to change notification settings - Fork 117
/
update_version.sh
executable file
·71 lines (59 loc) · 1.88 KB
/
update_version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
# Script for updating ObjectiveDropboxOfficial version number
echo
if [ "$#" -ne 1 ]; then
echo "Requires 1 parameter. Usage: \`./update_version <VERSION>\`"
exit 1
fi
arg_version_regex="^[0-9]+\.[0-9]+\.[0-9]+$"
version_regex="[0-9]+\.[0-9]+\.[0-9]+"
podspec=./ObjectiveDropboxOfficial.podspec
readme=./README.md
user_agent=Source/ObjectiveDropboxOfficial/Shared/Handwritten/Resources/DBSDKConstants.m
ios_version=Source/ObjectiveDropboxOfficial/Platform/ObjectiveDropboxOfficial_iOS/Info.plist
mac_version=Source/ObjectiveDropboxOfficial/Platform/ObjectiveDropboxOfficial_macOS/Info.plist
if ! [[ $1 =~ $arg_version_regex ]]; then
echo "\"$1\" version string must have format x.x.x"
exit 1
else
echo "Updating SDK text to version \"$1\""
fi
echo
echo
echo "Replacing podspec version number..."
sed -i '' -E "s/s.version = '$version_regex'/s.version = '$1'/" $podspec
echo '--------------------'
cat $podspec | grep $1
echo '--------------------'
echo
echo "Replacing README version number..."
sed -i '' -E "s/~> $version_regex/~> $1/" $readme
echo '--------------------'
cat $readme | grep $1
echo '--------------------'
echo
echo "Replacing User Agent version number..."
sed -i '' -E "s/kDBSDKVersion = @\"$version_regex\";/kDBSDKVersion = @\"$1\";/" $user_agent
echo '--------------------'
cat $user_agent | grep $1
echo '--------------------'
echo
echo "Replacing iOS xcodeproj version number..."
sed -i '' -E "s/$version_regex/$1/" $ios_version
echo '--------------------'
cat $ios_version | grep $1
echo '--------------------'
echo
echo "Replacing macOS xcodeproj version number..."
sed -i '' -E "s/$version_regex/$1/" $mac_version
echo '--------------------'
cat $mac_version | grep $1
echo '--------------------'
echo
echo
echo "Committing changes and tagging commit."
git commit -am "$1 release."
git tag "$1"
echo
echo "Changes ready for review and push"
echo