-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIncrementBuild
More file actions
executable file
·46 lines (43 loc) · 1.29 KB
/
IncrementBuild
File metadata and controls
executable file
·46 lines (43 loc) · 1.29 KB
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
#!/bin/sh
#Increment build
#Setup variables
CURRENT_COMMIT_HEAD="$(git rev-parse HEAD)"
CURRENT_COMMIT_REMOTE="$(git rev-parse origin/master)"
PROJECT_NAME="Json-Api-Example"
if [ "$CURRENT_COMMIT_HEAD" = "$CURRENT_COMMIT_REMOTE" ]; then
#Setup git
echo "Configuring of git..."
git config user.email "ios-admin@flatstack.com"
git config user.name "CI Server"
echo "Done"
#Get Info.plist file
CURRENT_DIR=$(dirname $PWD)
INFOPLIST_FILE="${PROJECT_NAME}/Info.plist"
echo "info.plist: ${INFOPLIST_FILE}"
echo ""
#Get build number
echo "Getting build number..."
BUILD_NUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
echo "Build number: ${BUILD_NUM}"
echo ""
#Create tag
TAG_NAME="Build_${BUILD_NUM}"
git tag $TAG_NAME
#Increment build number
BUILD_NUM=$(expr $BUILD_NUM + 1)
echo "Increasing build number to ${BUILD_NUM}..."
/usr/libexec/Plistbuddy -c "Set CFBundleVersion ${BUILD_NUM}" "${INFOPLIST_FILE}"
echo "Done"
#Commiting changes
echo "Commiting changes"
git add ${GREENHOUSE_BUILD_DIR}/${PROJECT_NAME}/Info.plist
git commit -m 'increment build number [skip ci]'
echo "Done"
#Pushing to git
echo "Pushing to git"
git push origin master
git push origin $TAG_NAME
echo "Done"
else
echo "Current branch is not master"
fi