This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
release.sh
executable file
·60 lines (48 loc) · 1.78 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
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
function askForSure {
read -p "What is the required CoreSDK version? " CORE_VERSION
while true; do
read -p "Did you mean to release MobileEngageSDK '$1' with CoreSDK '$CORE_VERSION'? " yn
case $yn in
[Yy]* ) release $1 ; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
}
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 MOBILEENGAGE_SDK_VERSION @\"$VERSION_NUMBER\"" > MobileEngage/MobileEngageVersion.h
TEMPLATE="`cat MobileEngageSDK.podspec.template`"
PODSPEC="${TEMPLATE/<VERSION_NUMBER>/$VERSION_NUMBER}"
PODSPEC="${PODSPEC/<COMMIT_REF>/:tag => spec.version}"
PODSPEC="${PODSPEC/spec.dependency \'CoreSDK\'/spec.dependency \'CoreSDK\', \'$CORE_VERSION\'}"
printf "$PODSPEC" > MobileEngageSDK.podspec
git add MobileEngage/MobileEngageVersion.h
git add MobileEngageSDK.podspec
git commit -m "chore(release): version set to $VERSION_NUMBER"
git tag -a "$VERSION_NUMBER" -m "$VERSION_NUMBER"
TEMPLATE="`cat MobileEngageSDK.podspec.template`"
PODSPEC="${TEMPLATE/<VERSION_NUMBER>/$VERSION_NUMBER}"
PODSPEC="${PODSPEC/<COMMIT_REF>/:tag => spec.version}"
printf "$PODSPEC" > MobileEngageSDK.podspec
git add MobileEngageSDK.podspec
git commit -m "chore(podspec): specific core version removed"
git push
git push origin $VERSION_NUMBER
pod spec lint --allow-warnings
pod trunk push MobileEngageSDK.podspec --allow-warnings
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