11# Sample workflow for building and deploying a VitePress site to GitHub Pages
2- #
3- name : Deploy VitePress site to Pages (next)
2+ name : Deploy VitePress site to gh-pages
43
54on :
65 # Runs on pushes targeting the `main` branch. Change this to `master` if you're
6059 - name : Build jsdoc
6160 run : npm run jsdoc-generate
6261 - name : Build vitepress build
63- run : npm run docs:build
62+ run : |
63+ cd packages/documentation
64+ # The base output
65+ npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_VERSION}/"
66+ npm run build:assets -- ./dist
67+ # The alias output
68+ npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_ALIAS}/" --outDir="dist-${DOC_ALIAS}"
69+ npm run build:assets -- ./dist-${DOC_ALIAS}
6470 - name : Build Schema
6571 run : |
6672 npm run schema-generate
@@ -74,16 +80,19 @@ jobs:
7480 run : |
7581 rm -rf ./gh-pages/schema
7682 cp -R ./site/schema ./gh-pages/
77- rm -rf ./gh-pages/${DOC_VERSION}/
83+ rm -rf ./gh-pages/${DOC_VERSION}
84+ rm -rf ./gh-pages/${DOC_ALIAS}
85+
86+ # Main version route
7887 cp -R ./packages/documentation/dist ./gh-pages/${DOC_VERSION}/
88+ cp -R ./site/api ./gh-pages/${DOC_VERSION}/api
89+
90+ # Alias route. E.g., next, latest, stable, etc.
91+ # For vitepress must be a copy with different config, not a symlink
92+ cp -R ./packages/documentation/dist-${DOC_ALIAS} ./gh-pages/${DOC_ALIAS}/
93+ cp -R ./site/api ./gh-pages/${DOC_ALIAS}/api
94+
7995 cp ./scripts/resources/custom404.html ./gh-pages/404.html
80- - name : Create or update alias route
81- run : |
82- cd ./gh-pages
83- # Remove existing alias if it exists (file or symlink)
84- rm -rf "${DOC_ALIAS}"
85- # Create symlink from alias to version directory
86- ln -s "${DOC_VERSION}" "${DOC_ALIAS}"
8796 - name : Publish Docs
8897 run : |
8998 cd ./gh-pages
0 commit comments