Repository navigation
109 lines (104 loc) · 3.46 KB
/
Copy pathvalidate.yml
File metadata and controls
109 lines (104 loc) · 3.46 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: 规则检查、锁定构建与 Pages 发布
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: 清单与项目结构
run: |
python3 -I scripts/check-manifests.py .
python3 -I scripts/check-system.py
- name: 规则回归
run: python3 -I scripts/test-check-system.py
- name: 定标原件回归
run: |
python3 -I scripts/check-reading-prototype.py
python3 -I scripts/test-reading-prototype.py
- name: 导出规则反例
run: |
python3 -I scripts/test-site-export.py
python3 -I scripts/test-content-export.py
- name: 迁移台账
# 原件不入库,CI 上只做登记对账;逐字比对只在有原件的本机发生
run: |
python3 -I scripts/test-migration.py
python3 -I scripts/check-migration.py
site:
runs-on: ubuntu-latest
permissions:
contents: read
pages: read
env:
NEXT_TELEMETRY_DISABLED: '1'
steps:
- uses: actions/checkout@v4
with:
submodules: false
- uses: actions/setup-node@v4
with:
node-version-file: src/.node-version
cache: npm
cache-dependency-path: src/package-lock.json
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: 锁定依赖、质量与构建
working-directory: src
run: |
npm ci --ignore-scripts --no-audit --no-fund --registry=https://registry.npmjs.org
npm ls --all
npm run lint
npm run typecheck
npm run build
- name: 正文管线规则
run: |
node --test scripts/test-content-loader.mjs scripts/test-search.mjs scripts/test-legacy-migration.mjs
node scripts/migrate-legacy-content.mjs --check-index
- name: 实际导出检查
run: |
python3 -I scripts/check-site-export.py
python3 -I scripts/check-content-export.py
- name: 内容上下架、中文分页与生产元数据
run: node scripts/test-blog-lifecycle.mjs --snapshot
- name: 保存可预览静态产物
uses: actions/upload-artifact@v4
with:
name: blog-static-site
path: src/out
retention-days: 7
- name: 配置 Pages
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions/configure-pages@v5
- name: 上传已验证的静态站点
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions/upload-pages-artifact@v4
with:
path: src/out
deploy:
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
needs: [validate, site]
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: 发布到 GitHub Pages
id: deployment
uses: actions/deploy-pages@v4