This repository was archived by the owner on Sep 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ name: Deploy Docs
44on :
55 push :
66 branches :
7- # make sure this is the branch you are using
87 - main
8+ pull_request :
9+ paths :
10+ - ' .github/workflows/deploy-ghpage.yml'
911
1012jobs :
1113 deploy-gh-pages :
@@ -15,16 +17,13 @@ jobs:
1517 uses : actions/checkout@v4
1618 with :
1719 fetch-depth : 0
18- # if your docs needs submodules, uncomment the following line
1920 # submodules: true
2021
21-
2222 - name : Install pnpm
23- uses : pnpm/action-setup@v2
23+ uses : pnpm/action-setup@v4
2424 with :
25- version : 7
26- run_install : true
27-
25+ version : 9.15.9
26+ run_install : false
2827
2928 - name : Setup Node.js
3029 uses : actions/setup-node@v4
@@ -38,11 +37,19 @@ jobs:
3837 - name : Build Docs
3938 env :
4039 NODE_OPTIONS : --max_old_space_size=8192
40+ DEPLOY_PLATFORM : github
4141 run : |-
4242 pnpm run docs:build
4343 > docs/.vuepress/dist/.nojekyll
4444
45+ - name : Upload Build Artifacts
46+ if : github.event_name == 'pull_request'
47+ uses : actions/upload-artifact@v4
48+ with :
49+ path : docs/.vuepress/dist
50+
4551 - name : Deploy
52+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
4653 uses : peaceiris/actions-gh-pages@v4
4754 with :
4855 github_token : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -5,9 +5,17 @@ import theme from "./theme.js";
55
66const __dirname = getDirname ( import . meta. url ) ;
77
8+ const getBasePath = ( ) => {
9+ const platform = process . env . DEPLOY_PLATFORM ;
10+ if ( platform === 'github' ) {
11+ return '/docs/' ;
12+ }
13+ return '/' ;
14+ } ;
15+
816export default defineUserConfig ( {
917 theme,
10- base : "/" , // For Github Pages
18+ base : getBasePath ( ) ,
1119 head : [
1220 [
1321 "link" ,
Original file line number Diff line number Diff line change 1212 "ecosystem" : " npx tsx scripts/ecosystem.ts" ,
1313 "dev-build" : " vuepress build docs" ,
1414 "docs:build" : " pnpm ecosystem && vuepress build docs" ,
15+ "docs:build:github" : " DEPLOY_PLATFORM=github pnpm ecosystem && vuepress build docs" ,
1516 "docs:clean-dev" : " vuepress dev docs --clean-cache" ,
1617 "docs:dev" : " vuepress dev docs" ,
1718 "dev" : " pnpm docs:dev"
You can’t perform that action at this time.
0 commit comments