From b2ef54f7c82cb46786f0b473a9b41f678d34083e Mon Sep 17 00:00:00 2001 From: Cee Chen <549407+cee-chen@users.noreply.github.com> Date: Tue, 12 Sep 2023 06:47:03 -0700 Subject: [PATCH] [CI] Deploy storybook (#7165) --- .gitignore | 1 + scripts/deploy/build_docs | 2 +- scripts/deploy/deploy_docs | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 8b1fcdabd2a..8ef0b049cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ test/failure-screenshots/**/*.png cypress/screenshots cypress/videos +storybook-static/ coverage/ reports/ .nyc_output/ diff --git a/scripts/deploy/build_docs b/scripts/deploy/build_docs index 5b2714fdfbf..54ce75954ef 100755 --- a/scripts/deploy/build_docs +++ b/scripts/deploy/build_docs @@ -14,4 +14,4 @@ docker run \ --volume "$PWD":/app \ --workdir /app \ $NODE_IMG \ - bash -c 'yarn && npm run build && npm run build-docs' + bash -c 'yarn && yarn build && yarn build-docs && yarn build-storybook' diff --git a/scripts/deploy/deploy_docs b/scripts/deploy/deploy_docs index 22e4456fff4..cb5ac77c6f5 100755 --- a/scripts/deploy/deploy_docs +++ b/scripts/deploy/deploy_docs @@ -53,7 +53,9 @@ post_comment_to_gh() done printf '\nAdding comment to GitHub Pull Request: %i\n' "${GIT_PULL_REQUEST_ID}" - comment="Preview documentation changes for this PR: https://eui.elastic.co/pr_${GIT_PULL_REQUEST_ID}/" + comment="Preview staging links for this PR: +- Docs site: https://eui.elastic.co/pr_${GIT_PULL_REQUEST_ID}/ +- Storybook: https://eui.elastic.co/pr_${GIT_PULL_REQUEST_ID}/storybook" curl \ --silent \ @@ -67,14 +69,20 @@ post_comment_to_gh() publish_to_bucket() { + copy_options=( + -m # enable multithreading + -h "Cache-Control: public, max-age=${max_age}, must-revalidate" # set caching policy + cp + -r # copy files recursively + -a public-read # set ACL to allow read by everyone + -z js,css,html # enable gzip encoding for these extensions + ) + echo "Copying ${PWD}/docs/* to ${full_bucket_path}" - gsutil -m \ - -h "Cache-Control:public, max-age=${max_age}, must-revalidate" \ - cp \ - -r \ - -a public-read \ - -z js,css,html \ - "${PWD}/docs/*" "${full_bucket_path}" + gsutil "${copy_options[@]}" "${PWD}/docs/*" "${full_bucket_path}" + + echo "Copying ${PWD}/storybook-static/* to ${full_bucket_path}storybook/" + gsutil "${copy_options[@]}" "${PWD}/storybook-static/*" "${full_bucket_path}storybook/" } if [[ "$1" != "nodocker" ]]; then