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
22+ environment : github-pages
3223 steps :
3324 - name : Checkout
3425 uses : actions/checkout@v4
3526 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
41- - name : Setup Node
27+ fetch-depth : 0
28+
29+ - name : Setup Node.js
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+
4635 - name : Setup Pages
4736 uses : actions/configure-pages@v4
37+
38+ - name : Create .env file
39+ run : |
40+ echo "VITEPRESS_BASE_URL=${{ vars.VITEPRESS_BASE_URL }}" >> .env
41+ echo "VITEPRESS_BASE=${{ vars.VITEPRESS_BASE }}" >> .env
42+
43+ # Debug .env content
44+ - name : Verify .env file contents
45+ run : cat .env
46+
4847 - name : Install dependencies
4948 run : npm ci # or pnpm install / yarn install / bun install
50- # - name: Set github env params to env file
51- # uses: c-py/action-dotenv-to-setenv@v5
52- # with:
53- # env-file: .env
54- - name : ' Create env file'
55- run : touch .env
56- - name : Creating .env file
57- 58- env :
59- VITEPRESS_BASE_URL : ' value'
60- VITEPRESS_BASE : ' value'
61- with :
62- variableName : VITEPRESS_BASE_URL,VITEPRESS_BASE
49+
50+ # - name: Create .env file
51+ # run: |
52+ # echo "VITEPRESS_BASE_URL=${{ secrets.VITEPRESS_BASE_URL }}" >> .env
53+ # echo "VITEPRESS_BASE=${{ secrets.VITEPRESS_BASE }}" >> .env
54+
55+ # # Debug .env content
56+ # - name: Verify .env file contents
57+ # run: cat .env
58+
59+ # Build with VitePress
6360 - name : Build with VitePress
6461 run : npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
62+
6563 - name : Upload artifact
6664 uses : actions/upload-pages-artifact@v3
6765 with :
6866 path : docs/.vitepress/dist
6967
70- # Deployment job
7168 deploy :
7269 environment :
7370 name : github-pages
7875 steps :
7976 - name : Deploy to GitHub Pages
8077 id : deployment
81- uses : actions/deploy-pages@v4
78+ uses : actions/deploy-pages@v4
0 commit comments