-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (81 loc) · 2.49 KB
/
video-build.yml
File metadata and controls
93 lines (81 loc) · 2.49 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
name: Build Promo Video
on:
push:
branches: [master, main]
paths:
- 'promo/**'
release:
types: [published]
workflow_dispatch:
concurrency:
group: video-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
render-video:
name: Render Promo Video
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg libcairo2-dev libpango1.0-dev
pip install manim==0.18.1 edge-tts mutagen
- name: Generate narration audio
run: |
cd promo
python generate_audio.py
cat durations.json
- name: Render synced promo video
run: |
cd promo
manim render -qh --format mp4 promo_scene.py ProductPromo
- name: Compute version-derived filename
id: vid
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
VERSION="dev-latest"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "filename=eApps_${VERSION}_promo.mp4" >> $GITHUB_OUTPUT
- name: Merge video + audio
run: |
cd promo
VIDEO=$(find media/videos -name "ProductPromo.mp4" | head -1)
if [ -z "$VIDEO" ]; then
echo "::error::Manim render produced no MP4"
exit 1
fi
if [ ! -f narration.mp3 ]; then
echo "::error::narration.mp3 missing"
exit 1
fi
ffmpeg -y -i "$VIDEO" -i narration.mp3 \
-c:v copy -c:a aac -b:a 192k \
-map 0:v:0 -map 1:a:0 \
-shortest \
${{ steps.vid.outputs.filename }}
ls -lh ${{ steps.vid.outputs.filename }}
- name: Upload final video
uses: actions/upload-artifact@v4
with:
name: eApps-promo-video
path: promo/${{ steps.vid.outputs.filename }}
retention-days: 90
- name: Attach to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: promo/${{ steps.vid.outputs.filename }}
tag_name: ${{ github.event.release.tag_name }}
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}