Skip to content

Commit b018f26

Browse files
devversionjelbourn
authored andcommitted
build: fix screenshot functions deploying (#5780)
* Fixes the screenshot functions deploying by properly resolving the path to the Firebase CLI binary. * Also cleans up the script to be aligned with the dashboard deployment script. * Removes firebase-tools as dependency from the dashboard since it's not used there anymore
1 parent 5962c93 commit b018f26

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

scripts/deploy/deploy-dashboard.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -e
55

66
# This script deploys the Dashboard App and their Cloud Functions to Firebase.
7-
# Before the script installs all dependencies and builds the dashboard app in production.
7+
# Before deploying, the script installs all dependencies and builds the dashboard app in production.
88

99
# Go to the project root directory
1010
cd $(dirname ${0})/../..
@@ -18,6 +18,9 @@ fi
1818
# Paths to the dashboard and functions directories.
1919
dashboardFolder=tools/dashboard
2020

21+
# Path to the firebase binary of the root package.json
22+
firebaseBin=$(npm bin)/firebase
23+
2124
# Go to the dashboard folder because otherwise the Firebase CLI tries to deploy the wrong project.
2225
cd ${dashboardFolder}
2326

@@ -34,5 +37,5 @@ wait
3437

3538
# Deploy the dashboard to Firebase. Based on the current configuration hosting and functions
3639
# will be deployed.
37-
$(npm bin)/firebase deploy --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} \
40+
${firebaseBin} deploy --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} \
3841
--non-interactive --project material2-board

scripts/deploy/deploy-screenshot-functions.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,31 @@
33
# The script should immediately exit if any command in the script fails.
44
set -e
55

6+
# This script deploys the Cloud Functions of the screenshot tool to Firebase.
7+
# Before deploying, the script installs all dependencies of the functions.
8+
9+
# Go to the project root directory
10+
cd $(dirname ${0})/../..
11+
612
if [ -z ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} ]; then
713
echo "Error: No access token for firebase specified." \
814
"Please set the environment variable 'MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN'."
915
exit 1
1016
fi
1117

12-
# Go to the project root directory
13-
cd $(dirname ${0})/../..
18+
# Path to the screenshot tool in the project.
19+
screenshotToolFolder="tools/dashboard"
1420

15-
# Paths to the screenshot-test directory that also contains the function directory.
16-
screenshotTestFolder=tools/screenshot-test
21+
# Path to the firebase binary of the root package.json
22+
firebaseBin=$(npm bin)/firebase
1723

1824
# Go to the screenshot-test folder because otherwise Firebase tries to deploy the wrong project.
19-
cd ${screenshotTestFolder}
25+
cd ${screenshotToolFolder}
2026

2127
# Install node modules for the screenshot functions. Firebase CLI needs to execute the functions
22-
# before it can collect all functions and deploy them.
28+
# to collect all function names before it can deploy them.
2329
(cd functions; npm install)
2430

2531
# Deploy the screenshot functions to Firebase
26-
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
27-
--project material2-screenshots
32+
${firebaseBin} deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
33+
--non-interactive --project material2-screenshots

tools/dashboard/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"@angular/language-service": "^4.2.6",
3636
"@types/jasmine": "2.5.45",
3737
"@types/node": "~6.0.60",
38-
"firebase-tools": "^3.9.1",
3938
"ts-node": "~3.0.4",
4039
"typescript": "^2.4.1"
4140
}

0 commit comments

Comments
 (0)