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 #7409

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 && yarn --cwd website && yarn --cwd website build'
9 changes: 8 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL doesn't have the trailing / at the end of the Docusaurus link, and I think that's what's causing the docs header to display twice when the URL resolves to /new-docs/index.html. If I add the trailing slash, it shows the header properly and has the same URL as the EUI logo in the docs preview site.


Screenshot 2023-12-07 at 2 03 33 PM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is strange. I'm testing some configuration variations to see if we can fix it without forcing that slash there just in case it would cause troubles when deployed to / in the future


curl \
--silent \
Expand All @@ -78,11 +79,17 @@ 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
echo "Copying ${PWD}/website/build/* to ${full_bucket_path}new-docs/"
gsutil "${copy_options[@]}" "${PWD}/website/build/*" "${full_bucket_path}new-docs/"
}

if [[ "$1" != "nodocker" ]]; then
Expand Down
4 changes: 3 additions & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const baseUrl = process.env.DOCS_BASE_URL || '/';

const config: Config = {
title: 'Elastic UI Framework',
tagline: 'The framework powering the Elastic Stack',
Expand All @@ -11,7 +13,7 @@ const config: Config = {
url: 'https://eui.elastic.co',

// Set the /<baseUrl>/ pathname under which your site is served
baseUrl: '/',
baseUrl,

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
Expand Down