-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci-deploy-firebase.sh
executable file
·55 lines (41 loc) · 1.2 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
#!/bin/bash
#------------------------------------------------------------------------
# A script to deploy a Firebase application.
#
#------------------------------------------------------------------------
# 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"
fi
PROJECT="$1"
shift
CI_BIN_DIRECTORY=$(realpath .ci) ||
fatal "could not determine bin directory"
export PATH="${PATH}:${CI_BIN_DIRECTORY}:."
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}"
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