-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
42 lines (42 loc) · 1.18 KB
/
deploy.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
deploymentFunctions(){
mainstring=${1#*:}
result=""
testKeyWord="Test"
if [[ $mainstring == *","* ]]; then
find=","
replace="Test,"
result="${mainstring//$find/$replace}$testKeyWord"
else
result="$mainstring$testKeyWord"
fi
firebase deploy --only functions:$result
}
productionFunctions(){
mainstring=$1
result=""
if [[ $mainstring == *"--prod"* ]]; then
newstr=${mainstring#*:}
result=$newstr
fi
firebase deploy --only functions:$result
}
str=$@
if [ -z "$str" ]; then
echo "Development without functions"
firebase use secondary-project-4e9d7
else
if [[ $str == *":"* ]] && [[ $str != *"--prod"* ]]; then
echo "Development with functions"
firebase use secondary-project-4e9d7
deploymentFunctions $str
elif [[ $str == *":"* ]] && [[ $str == *"--prod"* ]]; then
echo "Production with functions"
firebase use firstproject-ef6d3
productionFunctions $str
elif [[ $str != *":"* ]] && [[ $str == *"--prod"* ]]; then
echo "Production without Functions"
firebase use firstproject-ef6d3
else
echo "Invalid Script"
fi
fi