-
Notifications
You must be signed in to change notification settings - Fork 5k
100 lines (97 loc) · 2.77 KB
/
generate-catalog.yml
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
name: 生成文章目录
on:
push:
paths:
- 'integrals.md'
workflow_dispatch:
jobs:
generate:
if: github.repository == 'xitu/gold-miner'
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- label: '前端'
target: 'front-end.md'
- label: '后端'
target: 'backend.md'
- label: 'AI'
target: 'AI.md'
- label: '设计'
target: 'design.md'
- label: 'Android'
target: 'android.md'
- label: '算法'
target: 'algorithm.md'
- label: 'iOS'
target: 'ios.md'
- label: '其他'
target: 'others.md'
- label: '产品'
target: 'product.md'
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: |
python -m pip install lxml requests markdown
- uses: actions/checkout@master
with:
repository: xitu/juejin-integral-database
path: ./juejin-integral-database
- uses: actions/checkout@master
with:
path: ./gold-miner
token: ${{ secrets.LSVIH_PAT }}
- name: Generate Catalog
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABEL: ${{ matrix.label }}
TARGET: ${{ matrix.target }}
run: |
cd juejin-integral-database
echo -n "$TOKEN" > secret
python script_generate_catalog.py --label "$LABEL" --target "$TARGET"
mv new_$TARGET ../gold-miner/$TARGET
- name: Commit Catalog
uses: EndBug/add-and-commit@v7
with:
message: '更新${{ matrix.label }}文章目录'
author_name: 'lsvih'
author_email: '[email protected]'
add: '*.md'
cwd: './gold-miner/'
push: true
reindex:
if: github.repository == 'xitu/gold-miner'
needs: generate
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: actions/checkout@master
with:
repository: xitu/juejin-integral-database
path: ./juejin-integral-database
- uses: actions/checkout@master
with:
path: ./gold-miner
token: ${{ secrets.LSVIH_PAT }}
- name: Reindex catalogues
run: |
cd juejin-integral-database
python reindex.py
- name: Commit Catalog
uses: EndBug/add-and-commit@v7
with:
message: '更新最新文章索引'
author_name: 'lsvih'
author_email: '[email protected]'
add: 'README.md'
cwd: './gold-miner/'
push: true