This repository was archived by the owner on Aug 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ name: Deploy Docs
4
4
on :
5
5
push :
6
6
branches :
7
- # make sure this is the branch you are using
8
7
- main
8
+ pull_request :
9
+ paths :
10
+ - ' .github/workflows/deploy-ghpage.yml'
9
11
10
12
jobs :
11
13
deploy-gh-pages :
@@ -15,16 +17,13 @@ jobs:
15
17
uses : actions/checkout@v4
16
18
with :
17
19
fetch-depth : 0
18
- # if your docs needs submodules, uncomment the following line
19
20
# submodules: true
20
21
21
-
22
22
- name : Install pnpm
23
- uses : pnpm/action-setup@v2
23
+ uses : pnpm/action-setup@v4
24
24
with :
25
- version : 7
26
- run_install : true
27
-
25
+ version : 9.15.9
26
+ run_install : false
28
27
29
28
- name : Setup Node.js
30
29
uses : actions/setup-node@v4
@@ -38,11 +37,13 @@ jobs:
38
37
- name : Build Docs
39
38
env :
40
39
NODE_OPTIONS : --max_old_space_size=8192
40
+ DEPLOY_PLATFORM : github
41
41
run : |-
42
42
pnpm run docs:build
43
43
> docs/.vuepress/dist/.nojekyll
44
44
45
45
- name : Deploy
46
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
46
47
uses : peaceiris/actions-gh-pages@v4
47
48
with :
48
49
github_token : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -5,9 +5,17 @@ import theme from "./theme.js";
5
5
6
6
const __dirname = getDirname ( import . meta. url ) ;
7
7
8
+ const getBasePath = ( ) => {
9
+ const platform = process . env . DEPLOY_PLATFORM ;
10
+ if ( platform === 'github' ) {
11
+ return '/docs/' ;
12
+ }
13
+ return '/' ;
14
+ } ;
15
+
8
16
export default defineUserConfig ( {
9
17
theme,
10
- base : process . env . NODE_ENV === 'development' ? "/" : "/docs/" , // For Github Pages
18
+ base : getBasePath ( ) ,
11
19
head : [
12
20
[
13
21
"link" ,
Original file line number Diff line number Diff line change 12
12
"ecosystem" : " npx tsx scripts/ecosystem.ts" ,
13
13
"dev-build" : " vuepress build docs" ,
14
14
"docs:build" : " pnpm ecosystem && vuepress build docs" ,
15
+ "docs:build:github" : " DEPLOY_PLATFORM=github pnpm ecosystem && vuepress build docs" ,
15
16
"docs:clean-dev" : " vuepress dev docs --clean-cache" ,
16
17
"docs:dev" : " vuepress dev docs" ,
17
18
"dev" : " pnpm docs:dev"
You can’t perform that action at this time.
0 commit comments