This repository was archived by the owner on Jan 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathdeploy.sh
More file actions
86 lines (74 loc) · 2.28 KB
/
deploy.sh
File metadata and controls
86 lines (74 loc) · 2.28 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
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
#! /bin/sh
RED='\033[0;31m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
APP_ENV="staging"
APP_OS="ios and android"
DEPLOY_TYPE="soft"
while getopts ":e:o:t:" opt; do
case $opt in
e) APP_ENV="$OPTARG"
;;
o) APP_OS="$OPTARG"
;;
t) DEPLOY_TYPE="$OPTARG"
;;
\?) echo "${RED}Invalid option -$OPTARG${NO_COLOR}" >&2
;;
esac
done
if [ $DEPLOY_TYPE == "hard" ]; then
echo "${BLUE}* * * * *"
echo "👷 Hard-Deploy"
echo "* * * * *${NO_COLOR}"
if [[ $APP_OS != "android" ]]; then
echo "${GREEN}- - - - -"
echo "Fastlane 🍎 iOS $APP_ENV"
echo "- - - - -${NO_COLOR}"
bundle exec fastlane ios deploy --env=$APP_ENV
fi
if [[ $APP_OS != "ios" ]]; then
echo "${YELLOW}- - - - -"
echo "Fastlane 🤖 Android $APP_ENV"
echo "- - - - -${NO_COLOR}"
bundle exec fastlane android deploy --env=$APP_ENV
fi
fi
if [ $DEPLOY_TYPE == "soft" ]; then
echo "${CYAN}* * * * *"
echo "🍦 Soft-Deploy"
echo "* * * * *${NO_COLOR}"
git stash
git checkout integration
git pull
source fastlane/.env.$APP_ENV
mv src/environment/index.js src/environment/index.js.bak
cp src/environment/index.$APP_ENV.js src/environment/index.js
LAST_GIT_COMMIT=$(git log HEAD --pretty=format:"%h : %s" -1)
read -e -p "What's the changelog? (leave empty for \"$LAST_GIT_COMMIT\") " INPUT_CHANGELOG
MESSAGE="${INPUT_CHANGELOG:-$LAST_GIT_COMMIT}"
echo "${CYAN}Deploying Commit : $MESSAGE${NO_COLOR}"
yarn
if [ $APP_ENV == "production" ]; then
echo "- - - - -"
echo "️️️⚠️ No Codepush for Production yet"
echo "- - - - -"
else
if [[ $APP_OS != "android" ]]; then
echo "${GREEN}- - - - -"
echo "Codepush 🍎 iOS Staging"
echo "- - - - -${NO_COLOR}"
appcenter codepush release-react -d Staging -a <owner>/<MyApp>-iOS -m --target-binary-version $IOS_VERSION --description "$MESSAGE"
fi
if [[ $APP_OS != "ios" ]]; then
echo "${YELLOW}- - - - -"
echo "Codepush 🤖 Android Staging"
echo "- - - - -${NO_COLOR}"
appcenter codepush release-react -d Staging -a <owner>/<MyApp>-Android -m --target-binary-version $ANDROID_VERSION_NAME --description "$MESSAGE"
fi
fi
mv src/environment/index.js.bak src/environment/index.js
fi