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
This commit is contained in:
Paul Gschwendtner
2017-07-18 01:23:51 +02:00
committed by Jeremy Elbourn
parent 5962c9350b
commit b018f26e70
3 changed files with 19 additions and 11 deletions
+5 -2
View File
@@ -4,7 +4,7 @@
set -e
# This script deploys the Dashboard App and their Cloud Functions to Firebase.
# Before the script installs all dependencies and builds the dashboard app in production.
# Before deploying, the script installs all dependencies and builds the dashboard app in production.
# Go to the project root directory
cd $(dirname ${0})/../..
@@ -18,6 +18,9 @@ fi
# Paths to the dashboard and functions directories.
dashboardFolder=tools/dashboard
# Path to the firebase binary of the root package.json
firebaseBin=$(npm bin)/firebase
# Go to the dashboard folder because otherwise the Firebase CLI tries to deploy the wrong project.
cd ${dashboardFolder}
@@ -34,5 +37,5 @@ wait
# Deploy the dashboard to Firebase. Based on the current configuration hosting and functions
# will be deployed.
$(npm bin)/firebase deploy --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} \
${firebaseBin} deploy --token ${MATERIAL2_BOARD_FIREBASE_DEPLOY_KEY} \
--non-interactive --project material2-board
+14 -8
View File
@@ -3,25 +3,31 @@
# The script should immediately exit if any command in the script fails.
set -e
# This script deploys the Cloud Functions of the screenshot tool to Firebase.
# Before deploying, the script installs all dependencies of the functions.
# Go to the project root directory
cd $(dirname ${0})/../..
if [ -z ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} ]; then
echo "Error: No access token for firebase specified." \
"Please set the environment variable 'MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN'."
exit 1
fi
# Go to the project root directory
cd $(dirname ${0})/../..
# Path to the screenshot tool in the project.
screenshotToolFolder="tools/dashboard"
# Paths to the screenshot-test directory that also contains the function directory.
screenshotTestFolder=tools/screenshot-test
# Path to the firebase binary of the root package.json
firebaseBin=$(npm bin)/firebase
# Go to the screenshot-test folder because otherwise Firebase tries to deploy the wrong project.
cd ${screenshotTestFolder}
cd ${screenshotToolFolder}
# Install node modules for the screenshot functions. Firebase CLI needs to execute the functions
# before it can collect all functions and deploy them.
# to collect all function names before it can deploy them.
(cd functions; npm install)
# Deploy the screenshot functions to Firebase
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
--project material2-screenshots
${firebaseBin} deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
--non-interactive --project material2-screenshots