1- # Sample workflow for building and deploying a VitePress site to GitHub Pages
2- #
31name : Deploy VitePress site to Pages
42
53on :
6- # Runs on pushes targeting the `release` branch.
74 push :
85 branches : [master]
9- # Runs on pull_request targeting the `release` branch.
106 pull_request :
117 branches : [master]
12-
13- # Allows you to run this workflow manually from the Actions tab
148 workflow_dispatch :
159
16- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1710permissions :
1811 contents : read
1912 pages : write
2013 id-token : write
2114
22- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
23- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2415concurrency :
2516 group : pages
2617 cancel-in-progress : false
2718
2819jobs :
29- # Build job
3020 build :
3121 runs-on : ubuntu-latest
3222 steps :
3323 - name : Checkout
3424 uses : actions/checkout@v4
3525 with :
36- fetch-depth : 0 # Not needed if lastUpdated is not enabled
37- # - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm
38- # with:
39- # version: 9 # Not needed if you've set "packageManager" in package.json
40- # - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
26+ fetch-depth : 0
27+
28+ # Setup Node.js
4129 - name : Setup Node
4230 uses : actions/setup-node@v4
4331 with :
4432 node-version : 20
45- cache : npm # or pnpm / yarn
33+ cache : npm # or pnpm / yarn
34+
35+ # Setup Pages action
4636 - name : Setup Pages
4737 uses : actions/configure-pages@v4
38+
39+ # Install dependencies
4840 - name : Install dependencies
4941 run : npm ci # or pnpm install / yarn install / bun install
5042
43+ # Create .env file from environment variables
5144 - name : Create .env file
5245 run : |
5346 echo "VITEPRESS_BASE=${{ secrets.VITEPRESS_BASE }}" >> .env
5447 echo "VITEPRESS_BASE_URL=${{ secrets.VITEPRESS_BASE_URL }}" >> .env
55-
48+
5649 # Check if .env file was created (for debugging)
5750 - name : Verify .env file contents
5851 run : cat .env
59- # - name: 'Create env file'
60- # run: touch .env
61- # - name: Creating .env file
62- # uses: fmunirdev/[email protected] 63- # env:
64- # VITEPRESS_BASE_URL: 'value'
65- # VITEPRESS_BASE: 'value'
66- # with:
67- # variableName: VITEPRESS_BASE_URL,VITEPRESS_BASE
52+
53+ # Build with VitePress
6854 - name : Build with VitePress
6955 run : npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
56+
57+ # Upload artifact
7058 - name : Upload artifact
7159 uses : actions/upload-pages-artifact@v3
7260 with :
7361 path : docs/.vitepress/dist
7462
75- # Deployment job
7663 deploy :
7764 environment :
7865 name : github-pages
8370 steps :
8471 - name : Deploy to GitHub Pages
8572 id : deployment
86- uses : actions/deploy-pages@v4
73+ uses : actions/deploy-pages@v4
0 commit comments