Skip to content

Commit

Permalink
[CI] Deploy storybook (#7165)
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Sep 12, 2023
1 parent 29b77a2 commit b2ef54f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test/failure-screenshots/**/*.png
cypress/screenshots
cypress/videos

storybook-static/
coverage/
reports/
.nyc_output/
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/build_docs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
24 changes: 16 additions & 8 deletions scripts/deploy/deploy_docs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down

0 comments on commit b2ef54f

Please sign in to comment.