Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit e0d1da2

Browse files
authored
ci: add gha to automatic publish github pages
1 parent 39db242 commit e0d1da2

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy VitePress site to Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: false
19+
20+
jobs:
21+
# Build job
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
29+
- uses: pnpm/action-setup@v4 # Uncomment this if you're using pnpm
30+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
31+
- name: Setup Node
32+
uses: actions/setup-node@v4
33+
with:
34+
cache: pnpm # or pnpm / yarn
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v4
37+
- name: Install dependencies
38+
run: pnpm install
39+
- name: Build with VitePress
40+
run: pnpm docs:build
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: .vitepress/dist
45+
46+
# Deployment job
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
needs: build
52+
runs-on: ubuntu-latest
53+
name: Deploy
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)