Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: deploy new docs site when available #7408

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/deploy/build_docs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ set -e

NODE_IMG="docker.elastic.co/eui/ci:6.0"

# Docusaurus must know the base URL to work properly
DOCS_BASE_URL="/new-docs/"
if [ -n "${GIT_PULL_REQUEST_ID}" ] && [ "${GIT_PULL_REQUEST_ID}" != "false" ]; then
DOCS_BASE_URL="/pr_${GIT_PULL_REQUEST_ID}/new-docs/"
fi

echo "Docusaurus base URL set to: ${DOCS_BASE_URL}"

# Compile using node image
echo "Building docs using ${NODE_IMG} Docker image"
docker pull $NODE_IMG
docker run \
--rm -i \
--env HOME=/tmp \
--env DOCS_BASE_URL="$DOCS_BASE_URL" \
--"user=$(id -u)":"$(id -g)" \
--volume "$PWD":/app \
--workdir /app \
$NODE_IMG \
bash -c 'yarn && yarn build && yarn build-docs && yarn build-storybook'
bash -c 'yarn && yarn build && yarn build-docs && yarn build-storybook && if [[ -d website ]]; then yarn --cwd website && yarn --cwd website build; fi'
11 changes: 10 additions & 1 deletion scripts/deploy/deploy_docs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ post_comment_to_gh()
printf '\nAdding comment to GitHub Pull Request: %i\n' "${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"
- Storybook: https://eui.elastic.co/pr_${GIT_PULL_REQUEST_ID}/storybook
- New docs site (in development): https://eui.elastic.co/pr_${GIT_PULL_REQUEST_ID}/new-docs"

curl \
--silent \
Expand All @@ -78,11 +79,19 @@ publish_to_bucket()
-z js,css,html # enable gzip encoding for these extensions
)

# Current docs
echo "Copying ${PWD}/docs/* to ${full_bucket_path}"
gsutil "${copy_options[@]}" "${PWD}/docs/*" "${full_bucket_path}"

# Storybook
echo "Copying ${PWD}/storybook-static/* to ${full_bucket_path}storybook/"
gsutil "${copy_options[@]}" "${PWD}/storybook-static/*" "${full_bucket_path}storybook/"

# New docs
if [[ -d "${PWD}/website/build" ]]; then
echo "Copying ${PWD}/website/build/* to ${full_bucket_path}new-docs/"
gsutil "${copy_options[@]}" "${PWD}/website/build/*" "${full_bucket_path}new-docs/"
fi
}

if [[ "$1" != "nodocker" ]]; then
Expand Down
Loading