diff --git a/.travis.yml b/.travis.yml index 64c80238c7d..83e0af70704 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,4 +57,4 @@ after_success: cache: directories: - node_modules - - $HOME/.pub-cache + - tools/screenshot-test/functions/node_modules diff --git a/scripts/ci/after-success.sh b/scripts/ci/after-success.sh index 599f097f2ce..d16f853087e 100755 --- a/scripts/ci/after-success.sh +++ b/scripts/ci/after-success.sh @@ -9,6 +9,19 @@ cd $(dirname $0)/../.. # If not running as a PR, wait for all other travis modes to finish. if [ "$TRAVIS_PULL_REQUEST" = "false" ] && $(npm bin)/travis-after-modes; then echo "All travis modes passed. Publishing the build artifacts..." - ./scripts/release/publish-build-artifacts.sh - ./scripts/release/publish-docs-content.sh -fi + echo "" + + # Build Material, CDK and the docs before publishing artifacts + $(npm bin)/gulp material:build-release:clean + $(npm bin)/gulp material-examples:build-release + $(npm bin)/gulp docs + + # Run publishing of artifacts in parallel. This is possible because the output has been built before. + ./scripts/release/publish-build-artifacts.sh --no-build & + ./scripts/release/publish-docs-content.sh --no-build & + + # Deploy the screenshot functions for each push build. + ./scripts/release/deploy-screenshot-functions.sh & + + wait +#fi diff --git a/scripts/release/deploy-screenshot-functions.sh b/scripts/release/deploy-screenshot-functions.sh new file mode 100644 index 00000000000..1aad23bda36 --- /dev/null +++ b/scripts/release/deploy-screenshot-functions.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Go to the project root directory +cd $(dirname ${0})/../.. + +# Install node modules for screenshot functions. Firebase CLI needs to execute the functions +# before it can collect all functions and deploy them. +(cd tools/screenshot-test/functions; npm install) + +if [ -z ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN} ]; then + echo "Error: No access token for firebase specified." \ + "Please set the environment variable 'MATERIAL2_SCREENSHOT_ACCESS_TOKEN'." + exit 1 +fi + +# Deploy the screenshot functions to Firebase +$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN} diff --git a/scripts/release/publish-build-artifacts.sh b/scripts/release/publish-build-artifacts.sh index 84ab73dba8a..46c48e53f1b 100755 --- a/scripts/release/publish-build-artifacts.sh +++ b/scripts/release/publish-build-artifacts.sh @@ -12,6 +12,9 @@ cd $(dirname ${0})/../.. PACKAGES=(cdk material) REPOSITORIES=(cdk-builds material2-builds) +# Command line arguments. +COMMAND_ARGS=${*} + # Function to publish artifacts of a package to Github. # @param ${1} Name of the package # @param ${2} Repository name of the package. @@ -30,8 +33,10 @@ publishPackage() { repoUrl="https://github.com/angular/${packageRepo}.git" repoDir="tmp/${packageRepo}" - # Create a release of the current repository. - $(npm bin)/gulp ${packageName}:build-release:clean + if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then + # Create a release of the current repository. + $(npm bin)/gulp ${packageName}:build-release:clean + fi # Prepare cloning the builds repository rm -rf ${repoDir} diff --git a/scripts/release/publish-docs-content.sh b/scripts/release/publish-docs-content.sh index b4a757d16d8..62105135346 100755 --- a/scripts/release/publish-docs-content.sh +++ b/scripts/release/publish-docs-content.sh @@ -11,8 +11,10 @@ repoPath="/tmp/material2-docs-content" repoUrl="https://github.com/angular/material2-docs-content" examplesSource="./dist/docs/examples" -$(npm bin)/gulp material-examples:build-release:clean -$(npm bin)/gulp docs +if [[ ! ${*} == *--no-build* ]]; then + $(npm bin)/gulp material-examples:build-release:clean + $(npm bin)/gulp docs +fi # Get git meta info for commit commitSha="$(git rev-parse --short HEAD)"