Skip to content

build: fix screenshot functions deploying #5780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/deploy/deploy-dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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})/../..
Expand All @@ -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}

Expand All @@ -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
22 changes: 14 additions & 8 deletions scripts/deploy/deploy-screenshot-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion tools/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@angular/language-service": "^4.2.6",
"@types/jasmine": "2.5.45",
"@types/node": "~6.0.60",
"firebase-tools": "^3.9.1",
"ts-node": "~3.0.4",
"typescript": "^2.4.1"
}
Expand Down