Repository navigation
114 lines (101 loc) · 3.57 KB
/
Copy pathpages.yml
File metadata and controls
114 lines (101 loc) · 3.57 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
110
111
112
113
114
name: Build & Deploy GitHub Pages
on:
push:
branches: [main]
paths:
- "src/analysis_report/**"
- "src/trending_repo/**"
- "src/data/**"
# AI 日报篇A(ecosystem)落 src/daily_report/,新日报需触发站点重建;
# 篇B(frontier)落 src/ai_news/,不上站,故不列入 paths。
- "src/daily_report/**"
- "site/**"
- "scripts/**"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
env:
SITE_URL: ${{ vars.SITE_URL || 'https://nightvoyager.top' }}
PUBLIC_BASE_PATH: ${{ vars.PUBLIC_BASE_PATH || '/github-explore' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: requirements-ci.txt
- name: Install Python deps
# 用统一 requirements-ci.txt 让 pip cache key 在三条 workflow 间一致
run: pip install -r requirements-ci.txt
- name: Refresh metadata via SQLite (db.sqlite → reports.json / tags.yaml / starred.json / all_repos_deduped.json)
# 阶段 1-4 已迁库:reports + tags + starred + trending + publish_history 全部主写 DB
# JSON/YAML 由 init_db.py export-json dump;jsonl 是 publish 历史的 SoR
run: |
python3 src/scripts/init_db.py init
python3 src/scripts/init_db.py seed-publish
python3 src/scripts/build_reports_index.py
python3 src/scripts/extract_tags.py
python3 src/scripts/parse_starred.py
python3 src/scripts/seed_trending.py
python3 src/scripts/init_db.py export-json
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: site/package-lock.json
- name: Install site deps
working-directory: site
# 用 npm install 而非 ci:Astro / Sharp 的 Linux 平台 optional deps
# 在 macOS 上跑 npm install 时不会被解析进 lock;CI 上 npm ci 会因
# 缺 @emnapi/runtime 等 transitive deps 报错。install 容忍。
run: npm install --no-fund --no-audit --include=optional
- name: Build site
working-directory: site
run: npm run build
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
ping:
name: Ping search engines (IndexNow / 百度)
needs: deploy
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: requirements-ci.txt
- name: Push URLs
env:
SITE_URL: ${{ vars.SITE_URL || 'https://nightvoyager.top' }}
PUBLIC_BASE_PATH: ${{ vars.PUBLIC_BASE_PATH || '/github-explore' }}
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
BAIDU_PUSH_TOKEN: ${{ secrets.BAIDU_PUSH_TOKEN }}
run: python3 src/scripts/ping_search_engines.py
continue-on-error: true