Skip to content

Commit 358b54f

Browse files
committed
WIP Fixing versioned docs
1 parent 50acbf9 commit 358b54f

File tree

1 file changed

+74
-12
lines changed

1 file changed

+74
-12
lines changed

.github/workflows/docs.yml

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,32 @@ jobs:
114114
- name: Install dependencies
115115
run: npm ci
116116

117+
- name: Create versions.json for versioned build
118+
run: |
119+
cat > docs/.vitepress/versions.json << 'EOF'
120+
{
121+
"current": "1.0.0",
122+
"versions": [
123+
{ "version": "1.0.0", "label": "1.0.0 (Latest)", "path": "/" },
124+
{ "version": "0.6.3", "label": "0.6.3", "path": "/v0.6.3/" }
125+
]
126+
}
127+
EOF
128+
117129
- name: Create versioned config
118130
run: |
119131
VERSION="${{ matrix.version }}"
120132
cat > docs/.vitepress/config.versioned.mts << EOFCONFIG
121-
import baseConfig from './config.mts'
133+
import { defineConfig } from 'vitepress'
134+
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
135+
import {
136+
groupIconMdPlugin,
137+
groupIconVitePlugin,
138+
localIconLoader,
139+
} from "vitepress-plugin-group-icons"
140+
141+
// Read the original config dynamically
142+
import originalConfig from './config.mts'
122143
123144
const BASE = '/v${VERSION}/'
124145
@@ -138,19 +159,60 @@ jobs:
138159
}))
139160
}
140161
141-
const config = {
142-
...baseConfig,
162+
// Get the original theme config
163+
const origTheme = originalConfig.themeConfig || {}
164+
165+
export default defineConfig({
143166
base: BASE,
167+
markdown: {
168+
config(md) {
169+
md.use(groupIconMdPlugin)
170+
md.use(tabsMarkdownPlugin)
171+
}
172+
},
173+
vite: {
174+
plugins: [
175+
groupIconVitePlugin({
176+
customIcon: {
177+
ruby: "vscode-icons:file-type-ruby",
178+
".rb": "vscode-icons:file-type-ruby",
179+
".erb": "vscode-icons:file-type-erb",
180+
".html.erb": "https://raw.githubusercontent.com/marcoroth/herb/refs/heads/main/docs/.vitepress/assets/herb.svg",
181+
openai: 'logos:openai-icon',
182+
anthropic: 'logos:anthropic-icon',
183+
google: 'logos:google-icon',
184+
ollama: 'simple-icons:ollama',
185+
openrouter: localIconLoader(import.meta.url, './assets/icons/openrouter.svg'),
186+
}
187+
}),
188+
],
189+
},
190+
title: "Active Agent",
191+
description: "The AI framework for Rails with less code & more fun.",
192+
head: [
193+
['link', { rel: 'icon', href: BASE + 'activeagent.png' }],
194+
['link', { rel: 'icon', href: BASE + 'favicon-16x16.png', sizes: '16x16' }],
195+
['link', { rel: 'icon', href: BASE + 'favicon-32x32.png', sizes: '32x32' }],
196+
['link', { rel: 'apple-touch-icon', href: BASE + 'apple-touch-icon.png' }],
197+
['meta', { property: 'og:image', content: BASE + 'social.png' }],
198+
['meta', { property: 'og:title', content: 'Active Agent' }],
199+
['meta', { property: 'og:description', content: 'The AI framework for Rails with less code & more fun.' }],
200+
['meta', { property: 'og:url', content: 'https://docs.activeagents.ai' + BASE }],
201+
['meta', { property: 'og:type', content: 'website' }],
202+
],
203+
cleanUrls: true,
144204
themeConfig: {
145-
...baseConfig.themeConfig,
146-
nav: prefixItems(baseConfig.themeConfig?.nav || []),
147-
sidebar: Array.isArray(baseConfig.themeConfig?.sidebar)
148-
? prefixItems(baseConfig.themeConfig.sidebar)
149-
: baseConfig.themeConfig?.sidebar
150-
}
151-
}
152-
153-
export default config
205+
search: {
206+
provider: 'local',
207+
},
208+
editLink: origTheme.editLink,
209+
nav: prefixItems(origTheme.nav || []),
210+
sidebar: Array.isArray(origTheme.sidebar)
211+
? prefixItems(origTheme.sidebar)
212+
: origTheme.sidebar,
213+
socialLinks: origTheme.socialLinks || [],
214+
},
215+
})
154216
EOFCONFIG
155217
156218
- name: Build VitePress docs for v${{ matrix.version }}

0 commit comments

Comments
 (0)