-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.56 KB
/
deploy.yml
File metadata and controls
60 lines (53 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Deploy VitePress site to GitHub Pages
on:
# 在推送到 main 分支时触发
push:
branches: [main]
# 允许手动触发工作流
workflow_dispatch:
# 设置权限
permissions:
contents: read
jobs:
# 构建和部署工作
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: |
cd docs
npm install
- name: Build VitePress site
run: |
cd docs
npm run build
env:
NODE_ENV: production
- name: Deploy to target repository
uses: peaceiris/actions-gh-pages@v3
with:
# 使用个人访问令牌进行跨仓库部署
personal_token: ${{ secrets.PERSONAL_TOKEN }}
# 目标仓库
external_repository: xiumubai/xiumubai.github.io
# 发布目录
publish_dir: docs/.vitepress/dist
# 目标分支
publish_branch: main
# 目标目录
destination_dir: python-awesome-basic-coding
# 提交信息
commit_message: 'Deploy python-awesome-basic-coding docs from ${{ github.sha }}'
# 用户信息
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'