-
Notifications
You must be signed in to change notification settings - Fork 68
/
createPod.sh
executable file
·91 lines (72 loc) · 2.2 KB
/
createPod.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Need tag version! Ex: 2.0.5"
exit 0
fi
VERSION=$1
PROJECT="MercadoPagoSDK"
PODSPEC_FILE="$PROJECT.podspec"
GIT_BRANCH="development"
if [ "$#" -eq 2 ]
then
PROJECT=$2
fi
echo "=========================================="
echo " Creating POD Project : $PROJECT "
echo "=========================================="
echo "======================================================"
echo " 1) Update podspec file with spec version $VERSION"
echo "======================================================"
awk '/s.version.*/{if (M==""){sub("s.version.*","s.version = \"'$VERSION'\"");M=1}}{print}' $PODSPEC_FILE > $PODSPEC_FILE.temp
STATUS=$?
if [ $STATUS -ne 0 ]
then
rm $PODSPEC_FILE.temp
echo "Cannot update spec version in podspect file."
exit 0
fi
cp $PODSPEC_FILE.temp $PODSPEC_FILE
rm $PODSPEC_FILE.temp
echo "=========================================="
echo "2) Validate .podspec --allow-warnings"
echo "=========================================="
pod lib lint --allow-warnings --verbose
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Error ocurred. Validate podspec."
exit 0
fi
echo "=========================================="
echo "3) Create tag for version $VERSION from development branch"
echo "=========================================="
git checkout development
git tag $VERSION
git push origin $VERSION
PUSH_STATUS=$?
if [ $PUSH_STATUS -ne 0 ]
then
echo "Error ocurred pushing tag."
exit 0
fi
echo "=========================================="
echo "4) Push podspec into trunk/Specs"
echo "=========================================="
pod trunk push $PODSPEC_FILE --allow-warnings --verbose
POD_TRUNK_STATUS=$?
if [ $POD_TRUNK_STATUS -ne 0 ]
then
echo "Error ocurred pushing pod into trunk."
exit 0
fi
echo "=========================================="
echo "5) Push new podspec into master"
echo "=========================================="
pod trunk push $PODSPEC_FILE --allow-warnings
echo "=========================================="
echo " Pod created from tag $VERSION. "
echo " Versions available in "
echo "https://github.com/CocoaPods/Specs/tree/master/Specs/$PROJECT"
echo "=========================================="