-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (72 loc) · 2.47 KB
/
deploy.yml
File metadata and controls
88 lines (72 loc) · 2.47 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Deploy VitePress site to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
repository_dispatch:
types: [content-updated]
schedule:
# 每20天早上8点自动检查更新(北京时间,UTC+8,所以是UTC 0点)
- cron: '0 0 */20 * *'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # For actions/checkout
pages: write # For actions/deploy-pages
id-token: write # For actions/deploy-pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm install
- name: Checkout content repositories
run: |
# Create directory for content sources
mkdir -p content-source
# List of content repositories
repos=("AIknowledge" "auto" "book" "chinese-traditional" "cross-border" "curriculum" "edu-knowlege" "healthy" "movies" "self-media" "tools")
# Clone each repository
for repo in "${repos[@]}"; do
echo "Cloning $repo..."
git clone "https://github.com/mswnlz/$repo.git" "content-source/$repo" || {
echo "Warning: Failed to clone $repo, skipping..."
}
done
- name: Copy latest content from all repositories
run: |
# Set up paths
export SOURCE_BASE_DIR="./content-source"
export TARGET_DOCS_DIR="./docs"
# Run the content synchronization
# Note: copy_content.sh automatically calls scripts/seo-enhance.sh after copying
bash ./copy_content.sh
- name: Sync ResourceTabs configuration
env:
CONTENT_SOURCE_DIR: ./content-source
run: |
# 同步各分类 index.md 中的 ResourceTabs months 配置
bash ./scripts/sync-tabs.sh --auto || true
- name: Fetch latest commits
run: npm run fetch-commits
- name: Build VitePress site
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./docs/.vitepress/dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5