2017-05-22 23:58:32 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2017-06-29 19:32:00 +02:00
|
|
|
# The script should immediately exit if any command in the script fails.
|
|
|
|
|
set -e
|
|
|
|
|
|
2017-06-10 11:16:03 +02:00
|
|
|
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
|
|
|
|
|
|
2017-05-22 23:58:32 +02:00
|
|
|
# Go to the project root directory
|
|
|
|
|
cd $(dirname ${0})/../..
|
|
|
|
|
|
2017-06-10 11:16:03 +02:00
|
|
|
# Paths to the screenshot-test directory that also contains the function directory.
|
|
|
|
|
screenshotTestFolder=tools/screenshot-test
|
2017-05-22 23:58:32 +02:00
|
|
|
|
2017-06-10 11:16:03 +02:00
|
|
|
# Go to the screenshot-test folder because otherwise Firebase tries to deploy the wrong project.
|
|
|
|
|
cd ${screenshotTestFolder}
|
|
|
|
|
|
|
|
|
|
# Install node modules for the screenshot functions. Firebase CLI needs to execute the functions
|
|
|
|
|
# before it can collect all functions and deploy them.
|
|
|
|
|
(cd functions; npm install)
|
2017-05-22 23:58:32 +02:00
|
|
|
|
|
|
|
|
# Deploy the screenshot functions to Firebase
|
2017-06-10 11:16:03 +02:00
|
|
|
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
|
|
|
|
|
--project material2-screenshots
|