Skip to content

Commit b10fd25

Browse files
committed
tweaks for release docs
1 parent bab0ae8 commit b10fd25

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ jobs:
5858
- name: Build release documentation
5959
if: steps.release.outputs.exists == 'true'
6060
run: |
61-
# Save main build
61+
# Save main build and config (config has version dropdown code)
6262
mv docs/.vitepress/dist docs/.vitepress/dist-main
63+
cp docs/.vitepress/config.mts /tmp/config.mts
6364
64-
# Checkout and build at release tag
65+
# Checkout release tag
6566
git checkout ${{ steps.release.outputs.tag }}
67+
68+
# Restore config from main (has version dropdown and dynamic base path)
69+
cp /tmp/config.mts docs/.vitepress/config.mts
70+
71+
# Build at release tag with main's config
6672
pnpm install --frozen-lockfile
6773
pnpm -r run build
6874
RELEASE_VERSION=${{ steps.release.outputs.tag }} IS_RELEASE_BUILD=true pnpm run docs:build

docs/.vitepress/config.mts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,33 @@ import typedocSidebar from '../api/typedoc-sidebar.json';
55
const releaseVersion = process.env.RELEASE_VERSION || 'unreleased';
66
const isReleaseBuild = process.env.IS_RELEASE_BUILD === 'true';
77

8-
// Base path for this build
9-
const basePath = '/b2c-developer-tooling/';
8+
// Base paths - release build lives in /release/ subdirectory
9+
const siteBase = '/b2c-developer-tooling';
10+
const basePath = isReleaseBuild ? `${siteBase}/release/` : `${siteBase}/`;
1011

1112
// Build version dropdown items
12-
// Note: VitePress automatically prepends the base path to links, so we use root-relative paths
13+
// VitePress prepends base path to links starting with /, so we use relative paths
14+
// that work correctly for each build context
1315
function getVersionItems() {
14-
if (isReleaseBuild) {
15-
return [
16-
{ text: 'Development (main)', link: basePath },
17-
{ text: `Release (${releaseVersion})`, link: `${basePath}release/` },
18-
];
16+
if (releaseVersion === 'unreleased') {
17+
// No release yet - only show dev
18+
return [{ text: 'Development (main)', link: '/' }];
1919
}
20-
// Main branch build - check if there's a release version
21-
if (releaseVersion !== 'unreleased') {
20+
21+
if (isReleaseBuild) {
22+
// Release build: base is /b2c-developer-tooling/release/
23+
// Use ../ to navigate up to main docs
2224
return [
23-
{ text: 'Development (main)', link: '/' },
24-
{ text: `Release (${releaseVersion})`, link: '/release/' },
25+
{ text: 'Development (main)', link: '../' },
26+
{ text: `Release (${releaseVersion})`, link: '/' },
2527
];
2628
}
27-
// No release yet
28-
return [{ text: 'Development (main)', link: '/' }];
29+
30+
// Main build: base is /b2c-developer-tooling/
31+
return [
32+
{ text: 'Development (main)', link: '/' },
33+
{ text: `Release (${releaseVersion})`, link: '/release/' },
34+
];
2935
}
3036

3137
const guideSidebar = [
@@ -81,7 +87,7 @@ const guideSidebar = [
8187
export default defineConfig({
8288
title: 'B2C DX',
8389
description: 'Salesforce Commerce Cloud B2C Developer Experience - CLI, MCP Server, and SDK',
84-
base: '/b2c-developer-tooling/',
90+
base: basePath,
8591

8692
// Ignore dead links in api-readme.md (links are valid after TypeDoc generates the API docs)
8793
ignoreDeadLinks: [/^\.\/clients\//],

0 commit comments

Comments
 (0)