File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,40 +22,55 @@ concurrency:
2222 group : pages
2323 cancel-in-progress : false
2424
25- env :
26- NODE_VERSION : 20
27-
2825jobs :
29- build :
26+ deploy :
3027 runs-on : ubuntu-latest
28+ environment :
29+ name : github-pages
30+ url : ${{ steps.deployment.outputs.page_url }}
3131 steps :
3232 - name : Checkout
3333 uses : actions/checkout@v4
3434
3535 - name : Setup Node.js
3636 uses : actions/setup-node@v4
3737 with :
38- node-version : ${{ env.NODE_VERSION }}
38+ node-version : " 20 "
3939 cache : npm
4040
41+ - name : Configure GitHub Pages
42+ id : pages
43+ uses : actions/configure-pages@v5
44+
45+ - name : Set VitePress base
46+ shell : bash
47+ env :
48+ BASE_PATH : ${{ steps.pages.outputs.base_path }}
49+ run : |
50+ set -euo pipefail
51+ if [[ -z "${BASE_PATH}" ]]; then
52+ base="/"
53+ else
54+ base="${BASE_PATH%/}/"
55+ fi
56+ echo "VITEPRESS_BASE=${base}" >> "$GITHUB_ENV"
57+
4158 - name : Install dependencies
4259 run : npm ci
4360
4461 - name : Build for deployment
62+ env :
63+ VITEPRESS_BASE : ${{ env.VITEPRESS_BASE }}
4564 run : npm run build:ci
4665
66+ - name : Add .nojekyll
67+ run : touch .vitepress/dist/.nojekyll
68+
4769 - name : Upload Pages artifact
4870 uses : actions/upload-pages-artifact@v3
4971 with :
5072 path : .vitepress/dist
5173
52- deploy :
53- needs : build
54- runs-on : ubuntu-latest
55- environment :
56- name : github-pages
57- url : ${{ steps.deployment.outputs.page_url }}
58- steps :
5974 - name : Deploy to GitHub Pages
6075 id : deployment
6176 uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { sidebarZh } from './config/sidebar.js';
55export default defineConfig ( {
66 title : 'Awesome Cursor Rules' ,
77 description : '为中文开发者打造的 Cursor AI 编程规则集合' ,
8- base : '/awesome-cursorrules-zh/' ,
8+ base : process . env . VITEPRESS_BASE || '/awesome-cursorrules-zh/' ,
99 lang : 'zh-CN' ,
1010
1111 themeConfig : {
You can’t perform that action at this time.
0 commit comments