-
Notifications
You must be signed in to change notification settings - Fork 0
293 lines (254 loc) · 10.1 KB
/
gh-pages.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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
name: Deploy Jekyll
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: 'gh-pages'
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup Python 3.10.x
uses: actions/setup-python@v4
with:
python-version: "3.10.x"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Update Notes Links
id: update_notes_links
run: |
OUTPUT=$(python scripts/generate/update_notes_link.py)
if [[ "$OUTPUT" == *"Notes files changed, regenerating notes links."* ]]; then
echo "notes_updated=true" >> "$GITHUB_OUTPUT"
else
echo "notes_updated=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit Notes Link Changes
if: steps.update_notes_links.outputs.notes_updated == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add original/2025-01-11-notes-en.md
git diff --cached --quiet || git commit -m "chore(notes): Update notes links"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Language Files
id: updated_lang_files
run: |
DRY_RUN_LANG_OUTPUT=$(python scripts/translation/update_lang.py --dry_run)
TOTAL_POSTS=$(echo "$DRY_RUN_LANG_OUTPUT" | grep "Total Markdown files to process:" | awk '{print $NF}')
echo "Total posts to process: $TOTAL_POSTS"
if [[ "$TOTAL_POSTS" -eq 0 ]]; then
echo "No language files to update."
else
for i in $(seq 1 "$((2 + TOTAL_POSTS / 9 + (TOTAL_POSTS % 9 != 0)))"); do
python scripts/translation/update_lang.py --max_files 9 --model mistral
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add _posts/**/*.md
git diff --cached --quiet || git commit -m "chore(lang): Update language files"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
done
fi
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
- name: Dry Run Pdf Files
id: dry_run_pdf
run: |
DRY_RUN_PDF_OUTPUT=$(python scripts/pdf/update_pdf.py --max_files 1000 --dry_run)
echo "$DRY_RUN_PDF_OUTPUT"
if [[ "$DRY_RUN_PDF_OUTPUT" == *'Total Markdown files to process: 0'* ]]; then
echo "pdf_updated=false" >> "$GITHUB_OUTPUT"
else
echo "pdf_updated=true" >> "$GITHUB_OUTPUT"
fi
- name: Install Microsoft Core Fonts
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: |
sudo apt-get install -y ttf-mscorefonts-installer
fc-cache -fv
- name: Install Noto Fonts
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: |
sudo apt-get install -y fonts-noto
- name: Install Noto CJK
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: |
sudo apt-get install -y fonts-noto-cjk
- name: Install DejaVu Fonts
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: |
sudo apt-get install -y fonts-dejavu
- name: List Installed Fonts
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: fc-list
- name: Setup TeX Live
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
uses: teatimeguest/setup-texlive-action@v3
with:
packages: |
xeCJK
etoolbox
adjustbox
roboto
sourcesanspro
fontawesome5
tcolorbox
setspace
unicode-math
fancyvrb
olyglossia
polyglossia
bidi
booktabs
footnote
- name: Install Pandoc
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Run Pdf-Pipeline.py
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
run: |
python scripts/pdf/update_pdf.py --max_files 1000
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/pdfs/**/*.pdf
git diff --cached --quiet || git commit -m "chore(pdf): Update PDF files"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate with GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Dry run Audio Pipeline
id: dry_run_audio
run: |
DRY_RUN_OUTPUT=$(python scripts/audio/audio_pipeline.py --task posts --n 2 --dry_run)
echo "$DRY_RUN_OUTPUT"
FILES_PROCESSED=$(echo "$DRY_RUN_OUTPUT" | grep "Processing complete!" | awk '{print $3}' | cut -d'/' -f1)
TOTAL_FILES=$(echo "$DRY_RUN_OUTPUT" | grep "Processing complete!" | awk '{print $3}' | cut -d'/' -f2)
if [[ "$FILES_PROCESSED" -gt 0 ]]; then
echo "audio_updated=true" >> "$GITHUB_OUTPUT"
else
echo "audio_updated=false" >> "$GITHUB_OUTPUT"
fi
- name: Dry run Conversation Pipeline
id: dry_run_conversation
run: |
DRY_RUN_CONVERSATION_OUTPUT=$(python scripts/audio/conversation_pipeline.py --dry_run)
echo "$DRY_RUN_CONVERSATION_OUTPUT"
CONVERSATIONS_PROCESSED=$(echo "$DRY_RUN_CONVERSATION_OUTPUT" | grep "Processing complete!" | awk '{print $3}' | cut -d'/' -f1)
TOTAL_CONVERSATIONS=$(echo "$DRY_RUN_CONVERSATION_OUTPUT" | grep "Processing complete!" | awk '{print $3}' | cut -d'/' -f2)
if [[ "$CONVERSATIONS_PROCESSED" -gt 0 ]]; then
echo "conversation_updated=true" >> "$GITHUB_OUTPUT"
else
echo "conversation_updated=false" >> "$GITHUB_OUTPUT"
fi
- name: Install FFmpeg
if: steps.dry_run_audio.outputs.audio_updated == 'true' || steps.dry_run_conversation.outputs.conversation_updated == 'true'
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Run Audio Pipeline
if: steps.dry_run_audio.outputs.audio_updated == 'true'
run: |
python scripts/audio/audio_pipeline.py --task posts --n 2 --max_files 20
- name: Commit generated audio files
if: steps.dry_run_audio.outputs.audio_updated == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/audios/*.mp3
git diff --cached --quiet || git commit -m "feat(audio): Add generated audio files"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update audio Flags
if: steps.dry_run_audio.outputs.audio_updated == 'true'
run: |
python scripts/audio/audio_flag.py
python scripts/feed/feed.py --lang en
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add _posts/**/*.md
git add *.xml
git diff --quiet --staged || git commit -m "feat(audio): Update Audio flag and update audo feed"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Conversation Pipeline
if: steps.dry_run_conversation.outputs.conversation_updated == 'true'
run: |
python scripts/audio/conversation_pipeline.py
python scripts/feed/conversation_feed.py
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/conversations/*.mp3
git add *.xml
git diff --cached --quiet || git commit -m "feat(audio): Add generated conversation audio files"
git push || {
echo "Push failed, attempting pull and merge"
git pull --rebase
git push
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean Up Credentials
run: |
rm -f ./gha-creds-*.json
- name: Update Release Hash
run: python scripts/release/update_release.py
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Send Telegram Message
run: |
python scripts/release/telegram_bot.py --job send_message
env:
TELEGRAM_BOT_API_KEY: ${{ secrets.TELEGRAM_BOT_API_KEY }}