1+ # .github/workflows/deploy.yml
2+ name : Deploy VitePress site to GitHub Pages
3+
4+ on :
5+ push :
6+ branches :
7+ - main # Change to 'master' if that is your main branch
8+
9+ # Allows you to run this workflow manually from the Actions tab
10+ workflow_dispatch :
11+
12+ # Required permissions for the deployment action to work
13+ permissions :
14+ contents : read
15+ pages : write
16+ id-token : write
17+
18+ jobs :
19+ build_and_deploy :
20+ runs-on : ubuntu-latest
21+
22+ # Environment needed for deployment to GitHub Pages
23+ environment :
24+ name : github-pages
25+ url : ${{ steps.deployment.outputs.page_url }}
26+
27+ steps :
28+ # 1. Checkout the code
29+ - name : Checkout
30+ uses : actions/checkout@v4
31+ with :
32+ fetch-depth : 0 # Needed for generating git history if used on the site
33+
34+ # 2. Setup Node.js and pnpm
35+ - name : Setup Node.js and pnpm
36+ uses : actions/setup-node@v4
37+ with :
38+ node-version : 20 # Recommended to use a recent LTS version
39+ cache : ' pnpm' # Caches dependencies for faster installation
40+
41+ # 3. Install dependencies
42+ - name : Install dependencies (pnpm)
43+ run : pnpm install --frozen-lockfile
44+
45+ # 4. Build the VitePress site
46+ # The script is taken from your package.json: "docs:build": "vitepress build docs"
47+ - name : Build VitePress site
48+ run : pnpm run docs:build
49+
50+ # 5. Configure the deployment artifact
51+ - name : Setup Pages
52+ uses : actions/configure-pages@v5
53+
54+ # 6. Upload the generated artifacts (the 'dist' folder)
55+ - name : Upload artifact
56+ uses : actions/upload-pages-artifact@v3
57+ with :
58+ # Default output directory for VitePress
59+ path : docs/.vitepress/dist
60+
61+ # 7. Deploy to GitHub Pages
62+ - name : Deploy to GitHub Pages
63+ id : deployment
64+ uses : actions/deploy-pages@v4
0 commit comments