Skip to content

Commit a7c0270

Browse files
committed
feat(workflows): add audio pipeline workflow and refactor gh-pages
1 parent a4420e8 commit a7c0270

8 files changed

+57
-50
lines changed

.github/workflows/audio-pipeline.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
workflow_dispatch:
6+
name: Audio Pipeline
7+
jobs:
8+
audio_pipeline:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
- name: Authenticate with GCP
14+
uses: google-github-actions/auth@v1
15+
with:
16+
credentials_json: ${{ secrets.GCP_SA_KEY }}
17+
- name: Dry run Audio Pipeline
18+
id: dry_run_audio
19+
run: |
20+
DRY_RUN_OUTPUT=$(python audio-pipeline.py --task posts --n 10 --dry_run)
21+
FILES_TO_PROCESS=$(echo "$DRY_RUN_OUTPUT" | grep "Total Markdown files to process" | awk '{print $8}')
22+
23+
if [[ "$FILES_TO_PROCESS" -gt 0 ]]; then
24+
echo "audio_updated=true" >> "$GITHUB_OUTPUT"
25+
else
26+
echo "audio_updated=false" >> "$GITHUB_OUTPUT"
27+
fi
28+
- name: Install FFmpeg
29+
if: steps.dry_run_audio.outputs.audio_updated == 'true'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y ffmpeg
33+
34+
- name: Run Audio Pipeline
35+
if: steps.dry_run_audio.outputs.audio_updated == 'true'
36+
run: |
37+
python audio-pipeline.py --task posts --n 10
38+
39+
- name: Commit generated audio files
40+
if: steps.dry_run_audio.outputs.audio_updated == 'true'
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "github-actions[bot]@users.noreply.github.com"
44+
git add .
45+
git diff --cached --quiet || git commit -m "Add generated audio files"
46+
git push
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gh-pages.yml

+7-45
Original file line numberDiff line numberDiff line change
@@ -29,64 +29,26 @@ jobs:
2929
with:
3030
python-version: "3.x"
3131

32-
- name: Authenticate with GCP
33-
uses: google-github-actions/auth@v1
34-
with:
35-
credentials_json: ${{ secrets.GCP_SA_KEY }}
36-
3732
- name: Install Dependencies
3833
run: |
3934
python -m pip install --upgrade pip
4035
pip install -r requirements.txt
4136
42-
- name: Dry run Audio Pipeline
43-
id: dry_run_audio
44-
run: |
45-
python audio-pipeline.py --task posts --n 10 --dry_run
46-
47-
if [[ $(python audio-pipeline.py --task posts --n 10 --dry_run | grep "Total Markdown files to process" | awk '{print $8}') -gt 0 ]]; then
48-
echo "audio_updated=true" >> $GITHUB_OUTPUT
49-
else
50-
echo "audio_updated=false" >> $GITHUB_OUTPUT
51-
fi
52-
53-
- name: Install FFmpeg
54-
if: steps.dry_run_audio.outputs.audio_updated == 'true'
55-
run: |
56-
sudo apt-get update
57-
sudo apt-get install -y ffmpeg
58-
59-
- name: Run Audio Pipeline
60-
if: steps.dry_run_audio.outputs.audio_updated == 'true'
61-
run: |
62-
python audio-pipeline.py --task posts --n 10
63-
64-
- name: Commit generated audio files
65-
if: steps.dry_run_audio.outputs.audio_updated == 'true'
66-
run: |
67-
git config user.name "github-actions[bot]"
68-
git config user.email "github-actions[bot]@users.noreply.github.com"
69-
git add .
70-
git diff --cached --quiet || git commit -m "Add generated audio files"
71-
git push
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
7537
- name: Output git diff
7638
run: |
7739
git diff --name-only HEAD~1 HEAD
78-
40+
7941
- name: Dry run language files
8042
id: dry_run_lang
8143
run: |
8244
export DEEPSEEK_API_KEY=${{ secrets.DEEPSEEK_API_KEY }}
8345
DRY_RUN_OUTPUT=$(python scripts/update_lang.py --dry_run)
8446
echo "$DRY_RUN_OUTPUT"
85-
47+
8648
if [[ "$DRY_RUN_OUTPUT" == *'Total Markdown files to process: 0'* ]]; then
87-
echo "lang_updated=false" >> $GITHUB_OUTPUT
49+
echo "lang_updated=false" >> "$GITHUB_OUTPUT"
8850
else
89-
echo "lang_updated=true" >> $GITHUB_OUTPUT
51+
echo "lang_updated=true" >> "$GITHUB_OUTPUT"
9052
fi
9153
9254
- name: Update language files
@@ -97,8 +59,8 @@ jobs:
9759
9860
- name: Clean Up Credentials
9961
run: |
100-
rm -f ./gha-creds-*.json
101-
62+
rm -f ./gha-creds-*.json
63+
10264
- name: Commit language files
10365
if: steps.dry_run_lang.outputs.lang_updated == 'true'
10466
run: |
@@ -109,7 +71,7 @@ jobs:
10971
git push
11072
env:
11173
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112-
74+
11375
- name: Setup Pages
11476
uses: actions/configure-pages@v5
11577

404.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
permalink: /404.html
33
---
44
<script>
5-
if (window.location.pathname !== "/404-en") {
6-
window.location.href = "/404-en";
5+
if (window.location.pathname !== "/error-en") {
6+
window.location.href = "/error-en";
77
} else {
88
window.location.href = "/";
99
}

fix_template.sh

-3
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)