-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (134 loc) · 4.79 KB
/
Copy pathfull-pipeline.yml
File metadata and controls
155 lines (134 loc) · 4.79 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Full Pipeline
on:
schedule:
# Saturday 11pm UTC (adjust for your timezone: 5pm MDT, 4pm MST)
- cron: '0 23 * * 6'
workflow_dispatch:
inputs:
sync_batch_size:
description: 'Docs to sync to RAGFlow (0 = all)'
required: false
default: '0'
convert_batch_size:
description: 'Docs to convert to MkDocs (0 = all)'
required: false
default: '0'
linkfix_batch_size:
description: 'Docs to run link-fix on (0 = all eligible)'
required: false
default: '0'
completions_batch_size:
description: 'Docs to generate completions for (0 = all pending)'
required: false
default: '0'
sync_verify:
description: 'Verify synced docs exist in RAGFlow before syncing'
required: false
default: false
type: boolean
sync_force:
description: 'Force full re-sync by clearing ragflow_source_hash'
required: false
default: false
type: boolean
permissions:
contents: write
env:
PYTHONUNBUFFERED: "1"
jobs:
download:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up venv
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Download wiki pages
run: |
source venv/bin/activate
python scripts/download-wiki.py
- name: Download events
run: |
source venv/bin/activate
python scripts/download-events.py
- name: Download status
run: |
source venv/bin/activate
python scripts/download-status.py
- name: Sync to RAGFlow
env:
RAGFLOW_API_KEY: ${{ secrets.RAGFLOW_API_KEY }}
RAGFLOW_BASE_URL: ${{ secrets.RAGFLOW_BASE_URL }}
BATCH_SIZE: ${{ github.event.inputs.sync_batch_size || '0' }}
run: |
source venv/bin/activate
ARGS="--allow-failures"
if [ "${{ github.event.inputs.sync_verify }}" = "true" ]; then ARGS="$ARGS --verify"; fi
if [ "${{ github.event.inputs.sync_force }}" = "true" ]; then ARGS="$ARGS --force"; fi
python scripts/sync-ragflow.py $ARGS
- name: Convert to MkDocs
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
BATCH_SIZE: ${{ github.event.inputs.convert_batch_size || '0' }}
run: |
source venv/bin/activate
python scripts/convert-to-mkdocs.py
- name: Fix internal MkDocs links
env:
BATCH_SIZE: ${{ github.event.inputs.linkfix_batch_size || '0' }}
run: |
source venv/bin/activate
python scripts/fix-mkdocs-links.py
- name: Regenerate homepage
run: |
source venv/bin/activate
python scripts/generate-homepage.py
- name: Smoke build MkDocs site
run: |
source venv/bin/activate
mkdocs build -f mkdocs-site/mkdocs.yml
- name: Generate prompt completions
env:
RAGFLOW_API_KEY: ${{ secrets.RAGFLOW_API_KEY }}
RAGFLOW_BASE_URL: ${{ secrets.RAGFLOW_BASE_URL }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
BATCH_SIZE: ${{ github.event.inputs.completions_batch_size || '0' }}
run: |
source venv/bin/activate
python scripts/generate-completions.py
- name: Export training data
run: |
source venv/bin/activate
python scripts/export-training-data.py
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and push changes
run: |
git add -A docs/ mkdocs-site/ completions/ config/processing-state.json manifest.json training-data.jsonl
if git diff --staged --quiet; then
echo "No changes to commit."
exit 0
fi
ts="$(date -u +"%Y-%m-%d %H:%M:%S UTC")"
git commit -m "Full pipeline run ($ts)"
git push origin HEAD:${{ github.ref_name }}
- name: Deploy to gh-pages branch
run: |
cd mkdocs-site/site
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Deploy docs $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
git push --force https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages