forked from emartech/ios-emarsys-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·48 lines (38 loc) · 1.18 KB
/
release.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
#!/bin/bash
function askForSure {
read -p "Did you mean to release EmarsysSDK '$1'? " yn
case $yn in
[Yy]* ) release $1 ; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
}
function release {
VERSION_NUMBER="$1"
if GIT_DIR=.git git rev-parse $VERSION_NUMBER >/dev/null 2>&1
then
printf "Version tag already exist, exiting...\n"
exit
fi
printf "Releasing version $VERSION_NUMBER\n";
printf "#define EMARSYS_SDK_VERSION @\"$VERSION_NUMBER\"" > MobileEngage/MobileEngageVersion.h
TEMPLATE="`cat EmarsysSDK.podspec.template`"
PODSPEC="${TEMPLATE/<VERSION_NUMBER>/$VERSION_NUMBER}"
PODSPEC="${PODSPEC/<COMMIT_REF>/:tag => spec.version}"
printf "$PODSPEC" > EmarsysSDK.podspec
git add EmarsysSDK/EmarsysSDKVersion.h
git add EmarsysSDK.podspec
git commit -m "chore(release): version set to $VERSION_NUMBER"
git tag -a "$VERSION_NUMBER" -m "$VERSION_NUMBER"
git push
git push origin $VERSION_NUMBER
pod spec lint
pod trunk push EmarsysSDK.podspec
printf "[$VERSION_NUMBER] released, go eat some cookies."
}
if [ -z $1 ]; then
printf "USAGE: \r\n./release <version-number>\n";
exit
else
askForSure $1
fi