Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 9c28352

Browse files
liuxiaoycxw620
andauthored
fix: github pages assets 404 (#33)
* Fix For Github Pages fix https://openlistteam.github.io/docs/ * fix: github pages assets * feat: upload assets --------- Co-authored-by: Hantong Chen <cxwdyx620@gmail.com>
1 parent 8b2b0bf commit 9c28352

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

.github/workflows/deploy-docs.yml renamed to .github/workflows/deploy-ghpage.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ name: Deploy Docs
44
on:
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

1012
jobs:
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 }}

docs/.vuepress/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@ import theme from "./theme.js";
55

66
const __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+
816
export default defineUserConfig({
917
theme,
10-
base: "/", // For Github Pages
18+
base: getBasePath(),
1119
head: [
1220
[
1321
"link",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
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"

0 commit comments

Comments
 (0)