-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathci-deploy-firebase.sh
executable file
·62 lines (46 loc) · 1.37 KB
/
ci-deploy-firebase.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
#!/bin/bash
#------------------------------------------------------------------------
# A script to deploy all Firebase applications.
#
#------------------------------------------------------------------------
# Utility methods
#
fatal()
{
echo "ci-deploy-firebase.sh: fatal: $1" 1>&2
exit 1
}
info()
{
echo "ci-deploy-firebase.sh: info: $1" 1>&2
}
#------------------------------------------------------------------------
if [ $# -lt 1 ]
then
fatal "usage: project [project ...]"
fi
PROJECT_LIST="$1"
CI_BIN_DIRECTORY=$(realpath .ci) ||
fatal "could not determine bin directory"
export PATH="${PATH}:${CI_BIN_DIRECTORY}:."
ci-deploy-firebase-install.sh ||
fatal "could not install Firebase"
NODE_MODULES_BIN=$(realpath node_modules/.bin) ||
fatal "node modules are not installed"
FIREBASE="${NODE_MODULES_BIN}/firebase"
CI_FIREBASE_TOKEN=$(head -n 1 ".ci/credentials/Firebase/token.txt") ||
fatal "could not read firebase token from credentials repository"
info "deploying ${PROJECT_LIST}"
for PROJECT in ${PROJECT_LIST}
do
info "deploying ${PROJECT}"
if [ -f "${PROJECT}/firebase-aab.conf" ]
then
ci-deploy-firebase-aab.sh "${PROJECT}" ||
fatal "could not deploy ${PROJECT} AAB to Firebase"
elif [ -f "${PROJECT}/firebase-apk.conf" ]
then
ci-deploy-firebase-apk.sh "${PROJECT}" ||
fatal "could not deploy ${PROJECT} APK to Firebase"
fi
done