Skip to content

Commit e23d65f

Browse files
committed
ops(deploy): 更新GitHub Pages部署配置
1 parent e71394f commit e23d65f

2 files changed

Lines changed: 9 additions & 21 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ on:
55
branches: [main]
66

77
permissions:
8-
contents: read
9-
pages: write
8+
contents: write
9+
pages: read
1010
id-token: write
1111

12-
concurrency:
13-
group: "pages"
14-
cancel-in-progress: false
15-
1612
jobs:
1713
build:
1814
runs-on: ubuntu-latest
@@ -30,20 +26,10 @@ jobs:
3026
run: npm ci
3127

3228
- name: Build
33-
run: npm run build
29+
run: GITHUB_PAGES=true npm run build
3430

35-
- name: Upload artifact
36-
uses: actions/upload-pages-artifact@v3
31+
- name: Deploy
32+
uses: peaceiris/actions-gh-pages@v4
3733
with:
38-
path: ./dist
39-
40-
deploy:
41-
needs: build
42-
runs-on: ubuntu-latest
43-
environment:
44-
name: github-pages
45-
url: ${{ steps.deployment.outputs.page_url }}
46-
steps:
47-
- name: Deploy to GitHub Pages
48-
id: deployment
49-
uses: actions/deploy-pages@v4
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
publish_dir: ./dist

vite.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ const novelAiDevProxyPlugin = (): Plugin => ({
116116

117117
export default defineConfig(({ mode }) => {
118118
const env = loadEnv(mode, '.', '');
119+
const isGitHubPages = process.env.GITHUB_PAGES === 'true';
119120
return {
121+
base: isGitHubPages ? '/MoRanJiangHu/' : '/',
120122
server: {
121123
port: 3000,
122124
host: '0.0.0.0'

0 commit comments

Comments
 (0)