Skip to content

Commit e3b0242

Browse files
committed
fix(workflow): 修复 GitHub Pages 部署配置
- 修复构建命令: docs:build -> build - 添加 configure-pages@v5 动态获取 base_path - 添加 VITEPRESS_BASE 环境变量支持 - 添加 .nojekyll 文件生成 - 添加仓库过滤防止 fork 误部署 参考 kimi-cli 项目的最佳实践
1 parent fb67d3c commit e3b0242

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/pages.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v4
2626

27+
- name: Configure GitHub Pages
28+
id: pages
29+
uses: actions/configure-pages@v5
30+
2731
- name: Setup Node.js
2832
uses: actions/setup-node@v4
2933
with:
@@ -37,17 +41,20 @@ jobs:
3741

3842
- name: Build docs
3943
working-directory: docs
40-
run: npm run docs:build
41-
42-
- name: Verify output
43-
run: test -f docs/.vitepress/dist/index.html
44+
env:
45+
VITEPRESS_BASE: ${{ steps.pages.outputs.base_path }}
46+
run: |
47+
npm run build
48+
touch .vitepress/dist/.nojekyll
4449
4550
- name: Upload Pages artifact
4651
uses: actions/upload-pages-artifact@v3
4752
with:
4853
path: docs/.vitepress/dist
4954

5055
deploy:
56+
# Only run on the original repository, not on forks
57+
if: github.repository == 'LessUp/cpp-high-performance-guide'
5158
needs: build
5259
runs-on: ubuntu-latest
5360
environment:

0 commit comments

Comments
 (0)