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 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 && 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/"

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
5 changes: 4 additions & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ 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',
favicon: 'favicon.ico',
trailingSlash: true,

// Set the production url of your site here
url: 'https://eui.elastic.co',

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

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