-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
62 lines (60 loc) · 2.1 KB
/
action.yml
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
name: "Firebase"
description: "Sets up firebase tools"
inputs:
serviceAccount:
description: "Service account json file to use for authentication"
required: false
default: ""
version:
description: "The version to install, e.g. 12.4.3, blank for latest"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Cache firebase binary
id: firebase-cache
uses: actions/cache@v4
with:
path: |
/usr/local/bin/firebase
~/.cache/firebase/tools
key: ${{ runner.os }}-firebase-tools-${{ github.run_id }}
restore-keys: ${{ runner.os }}-firebase-tools-
- name: Install firebase-tools
env:
TOOLS_VERSION: ${{ inputs.version }}
run: |
function get_firebase () {
if [ "$2" == "" ]; then
curl -sL firebase.tools | analytics=false upgrade=$1 bash
else
curl -sL firebase.tools | sed "s/\/\$MACHINE\/latest/\/\$MACHINE\/v$2/g" | analytics=false upgrade=$1 bash
fi
}
get_firebase false $TOOLS_VERSION
echo -n Checking installed version...
if [ "$TOOLS_VERSION" == "" ]; then
# Check if the installed version is the latest version
if [ `firebase is:npm view firebase-tools version` != `firebase --version` ]; then
echo getting latest version.
get_firebase true
else
echo latest version is installed.
fi
else
# Check if the installed version is the version we want
if [ `firebase --version` != "$TOOLS_VERSION" ]; then
echo install version $TOOLS_VERSION.
get_firebase true $TOOLS_VERSION
else
echo version $TOOLS_VERSION is installed.
fi
fi
shell: bash
- name: Set service account
if: "${{ inputs.serviceAccount != '' }}"
run: |
echo '${{ inputs.serviceAccount }}' > $RUNNER_TEMP/.firebase_service_account.json
echo GOOGLE_APPLICATION_CREDENTIALS=$RUNNER_TEMP/.firebase_service_account.json >> $GITHUB_ENV
shell: bash