From f12159bef460c51209ea9edccc49080df5871c05 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 16 Aug 2018 21:03:19 +0200 Subject: [PATCH] build: ensure docs-content is up-to-date before deploy (#505) * Currently the `fetch-assets` script always fetches the data from the `master` branch. This is problematic because if we release a new patch release, we will incorrectly have the docs content for the upcoming major version. * Adds a small note that makes the publisher aware of the docs-content that should be kept updated. --- tools/deploy.sh | 12 +++++++++++- tools/fetch-assets.sh | 9 ++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/deploy.sh b/tools/deploy.sh index 113ab91eeb25..80ab3cd5fa69 100755 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -4,7 +4,7 @@ set -eu -o pipefail declare -A PROJECT_ID -#Firebase project Ids +# Firebase project ids PROJECT_ID["stable", "dev"]="material2-docs-dev" PROJECT_ID["stable", "prod"]="material-angular-io" PROJECT_ID["v5", "dev"]="material2-docs-5" @@ -14,7 +14,17 @@ version=${1:-stable} mode=${2:-dev} projectId=${PROJECT_ID[$version, $mode]} +echo "" +echo "NOTE: Make sure to refresh the docs-content to match the new version of docs." +echo " You can pull the docs-content for the new version by using the fetch-assets script." +echo "" +echo " e.g. ./tools/fetch-assets.sh 6.4.x" +echo "" + +read -p "Press to continue.." + npm run build-themes + $(npm bin)/ng build --aot --prod --build-optimizer=false $(npm bin)/firebase use $projectId $(npm bin)/firebase deploy diff --git a/tools/fetch-assets.sh b/tools/fetch-assets.sh index a3649a3fff9d..c803697a2358 100755 --- a/tools/fetch-assets.sh +++ b/tools/fetch-assets.sh @@ -6,6 +6,11 @@ cd $(dirname ${0})/../ +# Branch on the docs-content repository that includes the docs assets. The branch can +# be specified because in some situations we do not always want the docs-content of the +# master branch (e.g. if `master` reflects the next major version). +docsContentBranch=${1:-'master'} + # Directory where documentation assets should be copied to (overviews, api docs) documentsDestination=./src/assets/documents/ @@ -33,8 +38,10 @@ mkdir -p ${materialExamplesDestination} # Remove previous repository if directory is present. rm -Rf ${docsContentPath} +echo "Pulling docs-content assets for the branch: ${docsContentBranch}." + # Clone the docs-content repository. -git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1 +git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1 --branch ${docsContentBranch} # Copy all document assets (API, overview and guides). cp -R ${docsContentPath}/api ${documentsDestination}