Skip to content

Commit a1a7dcb

Browse files
devversionjelbourn
authored andcommitted
build: fix deploying of screenshot functions
* Updates the dashboard and screenshot deploy script to exit the process immediately if the Firebase token is not set. * Fixes that the error message of the dashboard still shows the old name of the token variable * Renames the screenshot variables to follow the dashboard environment variables * Explicitly specifies the project that will be uploaded in the screenshot deploy script (same as for dashboard)
1 parent 5e961cb commit a1a7dcb

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

scripts/deploy/deploy-screenshot-functions.sh

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

6+
if [ -z ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} ]; then
7+
echo "Error: No access token for firebase specified." \
8+
"Please set the environment variable 'MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN'."
9+
exit 1
10+
fi
11+
612
# Go to the project root directory
713
cd $(dirname ${0})/../..
814

9-
# Install node modules for screenshot functions. Firebase CLI needs to execute the functions
10-
# before it can collect all functions and deploy them.
11-
(cd tools/screenshot-test/functions; npm install)
15+
# Paths to the screenshot-test directory that also contains the function directory.
16+
screenshotTestFolder=tools/screenshot-test
1217

13-
if [ -z ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN} ]; then
14-
echo "Error: No access token for firebase specified." \
15-
"Please set the environment variable 'MATERIAL2_SCREENSHOT_ACCESS_TOKEN'."
16-
exit 1
17-
fi
18+
# Go to the screenshot-test folder because otherwise Firebase tries to deploy the wrong project.
19+
cd ${screenshotTestFolder}
20+
21+
# Install node modules for the screenshot functions. Firebase CLI needs to execute the functions
22+
# before it can collect all functions and deploy them.
23+
(cd functions; npm install)
1824

1925
# Deploy the screenshot functions to Firebase
20-
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN}
26+
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} \
27+
--project material2-screenshots

tools/gulp/util/firebase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function openScreenshotsBucket() {
3838
projectId: 'material2-screenshots',
3939
credentials: {
4040
client_email: 'firebase-adminsdk-t4209@material2-screenshots.iam.gserviceaccount.com',
41-
private_key: decode(process.env['MATERIAL2_SCREENSHOT_FIREBASE_KEY'])
41+
private_key: decode(process.env['MATERIAL2_SCREENSHOT_FIREBASE_SERVICE_KEY'])
4242
},
4343
});
4444

0 commit comments

Comments
 (0)