forked from w9jds/firebase-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·32 lines (25 loc) · 867 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·32 lines (25 loc) · 867 Bytes
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
#!/bin/bash
set -e
if [ -z "$FIREBASE_TOKEN" ] && [ -z "$GCP_SA_KEY" ]; then
echo "Either FIREBASE_TOKEN or GCP_SA_KEY is required to run commands with the firebase cli"
exit 126
fi
if [ -n "$GCP_SA_KEY" ]; then
if echo "$GCP_SA_KEY" | jq empty 2>/dev/null; then
echo "Storing GCP_SA_KEY in /opt/gcp_key.json"
echo "$GCP_SA_KEY" > /opt/gcp_key.json
else
echo "Storing the decoded GCP_SA_KEY in /opt/gcp_key.json"
echo "$GCP_SA_KEY" | base64 -d > /opt/gcp_key.json # If encoded base64 key, decode and save
fi
echo "Exporting GOOGLE_APPLICATION_CREDENTIALS=/opt/gcp_key.json"
export GOOGLE_APPLICATION_CREDENTIALS=/opt/gcp_key.json
fi
if [ -n "$PROJECT_PATH" ]; then
cd "$PROJECT_PATH"
fi
if [ -n "$PROJECT_ID" ]; then
echo "setting firebase project to $PROJECT_ID"
firebase use --add "$PROJECT_ID"
fi
sh -c "firebase $*"