3131 node-version : 22
3232 cache : npm
3333
34+ - name : Install system deps
35+ run : |
36+ sudo apt-get update
37+ sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config
38+
3439 - name : Setup Ruby
3540 uses : ruby/setup-ruby@v1
3641 with :
4045 - name : Install dependencies
4146 run : npm ci
4247
43- - name : Install Ruby dependencies
44- run : bundle install
45-
4648 - name : Generate versions.json
4749 run : |
4850 CURRENT_VERSION=$(grep 'VERSION = "' lib/active_agent/version.rb | sed 's/.*VERSION = "\([^"]*\)".*/\1/')
@@ -51,21 +53,23 @@ jobs:
5153 "current": "$CURRENT_VERSION",
5254 "versions": [
5355 { "version": "$CURRENT_VERSION", "label": "$CURRENT_VERSION (Latest)", "path": "/" },
54- { "version": "1.0.0", "label": "1.0.0", "path": "/v1.0.0/" },
55- { "version": "0.6.3", "label": "0.6.3", "path": "/v0.6.3/" }
56+ { "version": "0.6.3", "label": "0.6.3", "path": "/v0.6.3/docs" }
5657 ]
5758 }
5859 EOF
5960
61+ - name : Install dummy app dependencies
62+ working-directory : test/dummy
63+ run : bundle install
64+
6065 - name : Setup database
6166 env :
6267 RAILS_ENV : test
6368 RAILS_MASTER_KEY : ${{ secrets.RAILS_MASTER_KEY }}
69+ working-directory : test/dummy
6470 run : |
65- cd test/dummy
6671 bundle exec rails db:create
6772 bundle exec rails db:migrate
68- cd ../..
6973
7074 - name : Generate doc examples from tests
7175 env :
@@ -86,16 +90,13 @@ jobs:
8690 path : docs/.vitepress/dist
8791
8892 # Build versioned docs using matrix strategy
93+ # Note: Versioned docs are built from static content in tags (no test generation needed)
8994 build-versioned :
9095 runs-on : ubuntu-latest
9196 strategy :
9297 fail-fast : false
9398 matrix :
94- include :
95- - version : " 1.0.0"
96- ruby : " 3.4"
97- - version : " 0.6.3"
98- ruby : " 3.3"
99+ version : ["0.6.3"]
99100 steps :
100101 - name : Checkout version ${{ matrix.version }}
101102 uses : actions/checkout@v6
@@ -109,50 +110,31 @@ jobs:
109110 node-version : 22
110111 cache : npm
111112
112- - name : Setup Ruby
113- uses : ruby/setup-ruby@v1
114- with :
115- ruby-version : ${{ matrix.ruby }}
116- bundler-cache : true
117-
118113 - name : Install dependencies
119114 run : npm ci
120115
121- - name : Install Ruby dependencies
122- run : bundle install
123-
124- - name : Setup database
125- env :
126- RAILS_ENV : test
127- RAILS_MASTER_KEY : ${{ secrets.RAILS_MASTER_KEY }}
116+ - name : Inject base path into existing config
128117 run : |
129- cd test/dummy
130- bundle exec rails db:create || true
131- bundle exec rails db:migrate || true
132- cd ../..
118+ # Insert base path after the first defineConfig({ line
119+ # This preserves the original sidebar, nav, and all other settings
120+ sed -i "s|export default defineConfig({|export default defineConfig({\n base: '/v${{ matrix.version }}/',\n ignoreDeadLinks: true,|" docs/.vitepress/config.mts
133121
134- - name : Generate doc examples from tests
135- env :
136- RAILS_ENV : test
137- RAILS_MASTER_KEY : ${{ secrets.RAILS_MASTER_KEY }}
138- ANTHROPIC_API_KEY : ANTHROPIC_API_KEY
139- OPEN_AI_API_KEY : OPEN_AI_API_KEY
140- OPEN_ROUTER_API_KEY : OPEN_ROUTER_API_KEY
141- run : bin/test || echo "Tests completed"
142-
143- - name : Create versioned config
144- run : |
145- cat > docs/.vitepress/config.versioned.mts << EOF
146- import baseConfig from './config.mts'
147-
148- export default {
149- ...baseConfig,
150- base: '/v${{ matrix.version }}/'
151- }
152- EOF
122+ # Show the modified config for debugging
123+ echo "Modified config.mts:"
124+ head -20 docs/.vitepress/config.mts
153125
154126 - name : Build VitePress docs for v${{ matrix.version }}
155- run : npx vitepress build docs --config docs/.vitepress/config.versioned.mts
127+ run : npx vitepress build docs
128+
129+ - name : Fix internal links for versioned docs
130+ run : |
131+ # Rewrite internal absolute links to include the version prefix
132+ # This fixes links in markdown content that use absolute paths like /docs/...
133+ find docs/.vitepress/dist -name "*.html" -exec sed -i \
134+ -e 's|href="/docs/|href="/v${{ matrix.version }}/docs/|g' \
135+ -e 's|href="/activeagent.png"|href="/v${{ matrix.version }}/activeagent.png"|g' \
136+ {} \;
137+ echo "Fixed internal links for v${{ matrix.version }}"
156138
157139 - name : Upload versioned docs artifact
158140 uses : actions/upload-artifact@v5
0 commit comments