Skip to content

Commit ecea23c

Browse files
devversiontinayuangao
authored andcommitted
build: deploy screenshot functions (#4698)
* build: deploy screenshot functions * Deploys the screenshot functions for push builds * Runs deploying & publishing in parallel * Fix comment about parallel
1 parent eecf897 commit ecea23c

File tree

5 files changed

+45
-8
lines changed

5 files changed

+45
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ after_success:
5757
cache:
5858
directories:
5959
- node_modules
60-
- $HOME/.pub-cache
60+
- tools/screenshot-test/functions/node_modules

scripts/ci/after-success.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ cd $(dirname $0)/../..
99
# If not running as a PR, wait for all other travis modes to finish.
1010
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && $(npm bin)/travis-after-modes; then
1111
echo "All travis modes passed. Publishing the build artifacts..."
12-
./scripts/release/publish-build-artifacts.sh
13-
./scripts/release/publish-docs-content.sh
14-
fi
12+
echo ""
13+
14+
# Build Material, CDK and the docs before publishing artifacts
15+
$(npm bin)/gulp material:build-release:clean
16+
$(npm bin)/gulp material-examples:build-release
17+
$(npm bin)/gulp docs
18+
19+
# Run publishing of artifacts in parallel. This is possible because the output has been built before.
20+
./scripts/release/publish-build-artifacts.sh --no-build &
21+
./scripts/release/publish-docs-content.sh --no-build &
22+
23+
# Deploy the screenshot functions for each push build.
24+
./scripts/release/deploy-screenshot-functions.sh &
25+
26+
wait
27+
#fi
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Go to the project root directory
4+
cd $(dirname ${0})/../..
5+
6+
# Install node modules for screenshot functions. Firebase CLI needs to execute the functions
7+
# before it can collect all functions and deploy them.
8+
(cd tools/screenshot-test/functions; npm install)
9+
10+
if [ -z ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN} ]; then
11+
echo "Error: No access token for firebase specified." \
12+
"Please set the environment variable 'MATERIAL2_SCREENSHOT_ACCESS_TOKEN'."
13+
exit 1
14+
fi
15+
16+
# Deploy the screenshot functions to Firebase
17+
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN}

scripts/release/publish-build-artifacts.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ cd $(dirname ${0})/../..
1212
PACKAGES=(cdk material)
1313
REPOSITORIES=(cdk-builds material2-builds)
1414

15+
# Command line arguments.
16+
COMMAND_ARGS=${*}
17+
1518
# Function to publish artifacts of a package to Github.
1619
# @param ${1} Name of the package
1720
# @param ${2} Repository name of the package.
@@ -30,8 +33,10 @@ publishPackage() {
3033
repoUrl="https://github.com/angular/${packageRepo}.git"
3134
repoDir="tmp/${packageRepo}"
3235

33-
# Create a release of the current repository.
34-
$(npm bin)/gulp ${packageName}:build-release:clean
36+
if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then
37+
# Create a release of the current repository.
38+
$(npm bin)/gulp ${packageName}:build-release:clean
39+
fi
3540

3641
# Prepare cloning the builds repository
3742
rm -rf ${repoDir}

scripts/release/publish-docs-content.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ repoPath="/tmp/material2-docs-content"
1111
repoUrl="https://github.com/angular/material2-docs-content"
1212
examplesSource="./dist/docs/examples"
1313

14-
$(npm bin)/gulp material-examples:build-release:clean
15-
$(npm bin)/gulp docs
14+
if [[ ! ${*} == *--no-build* ]]; then
15+
$(npm bin)/gulp material-examples:build-release:clean
16+
$(npm bin)/gulp docs
17+
fi
1618

1719
# Get git meta info for commit
1820
commitSha="$(git rev-parse --short HEAD)"

0 commit comments

Comments
 (0)