-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
140 lines (127 loc) · 4.61 KB
/
action.yml
File metadata and controls
140 lines (127 loc) · 4.61 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
---
name: ScreenKit Episode
description: Export a screencast episode using Docker
inputs:
episode:
description: "Episode number (e.g. 001)"
required: true
tts_preset:
description: "TTS preset name"
default: ""
required: false
tts_api_key:
description: "TTS API key"
required: false
overwrite:
description: "Regenerate files"
default: "false"
required: false
match:
description: "Match pattern for segments (e.g. 001)"
default: ""
required: false
github_token:
description: "GitHub token for cache operations"
required: true
retention:
description: "Retention days for artifacts"
default: "2"
runs:
using: composite
steps:
- name: Generate cache keys
shell: bash
run: |
VOICEOVER_HASH=$(find episodes/${{ inputs.episode }}-*/scripts/*.txt -type f 2>/dev/null | sort | xargs sha256sum 2>/dev/null | sha256sum | cut -d' ' -f1 || echo "none")
CONTENT_HASH=$(find episodes/${{ inputs.episode }}-*/*/*.* -type f 2>/dev/null | sort | xargs sha256sum 2>/dev/null | sha256sum | cut -d' ' -f1 || echo "none")
echo "VOICEOVER_CACHE_KEY=episode-voiceover-${{ inputs.episode }}-${VOICEOVER_HASH}" >> $GITHUB_ENV
echo "VOICEOVER_RESTORE_KEY=episode-voiceover-${{ inputs.episode }}-" >> $GITHUB_ENV
echo "VIDEO_CACHE_KEY=episode-${{ inputs.episode }}-${CONTENT_HASH}" >> $GITHUB_ENV
echo "VIDEO_RESTORE_KEY=episode-${{ inputs.episode }}-" >> $GITHUB_ENV
- name: Find episode dir
shell: bash
run: |
EPISODE_DIR=$(ls -1d episodes/${{ inputs.episode }}-* | head -n 1)
echo "EPISODE_DIR=$EPISODE_DIR" >> $GITHUB_ENV
if [[ ! -d "$EPISODE_DIR" ]]; then
echo "Episode directory not found!"
echo "Available episodes:"
ls -1 episodes
exit 1
fi
- name: Restore episode voice cache
id: cache-voice
uses: actions/cache/restore@v5
with:
path: episodes/${{ inputs.episode }}-*/voiceovers
key: ${{ env.VOICEOVER_CACHE_KEY }}
restore-keys: ${{ env.VOICEOVER_RESTORE_KEY }}
enableCrossOsArchive: true
- name: Restore videos cache
id: cache-videos
uses: actions/cache/restore@v5
with:
path: output/${{ inputs.episode }}-*/videos/*.mp4
key: ${{ env.VIDEO_CACHE_KEY }}
restore-keys: ${{ env.VIDEO_RESTORE_KEY }}
enableCrossOsArchive: true
- name: Export Episode
shell: bash
id: screenkit
run: |
set -e
docker run \
--rm \
--cap-add=SYS_ADMIN \
--shm-size=2g \
--security-opt seccomp=unconfined \
-v ${{ github.workspace }}:/source \
fnando/screenkit:latest \
episode export \
--dir="${{ env.EPISODE_DIR }}" \
${{ inputs.match != '' && format('--match-segment {0}', inputs.match) || '' }} \
${{ inputs.overwrite == 'true' && '--overwrite' || '--no-overwrite' }} \
${{ inputs.tts_preset != '' && format('--tts-preset {0}', inputs.tts_preset) || '' }} \
${{ inputs.tts_api_key != '' && format('--tts-api-key {0}', inputs.tts_api_key) || '' }}
echo "result=true" >> $GITHUB_OUTPUT
- name: Delete voice cache
if: steps.screenkit.outputs.result == 'true'
shell: bash
run: gh cache delete "${{ env.VOICEOVER_CACHE_KEY }}" || true
env:
GH_TOKEN: ${{ inputs.github_token }}
- name: Delete videos cache
if: steps.screenkit.outputs.result == 'true'
shell: bash
run: gh cache delete "${{ env.VIDEO_CACHE_KEY }}" || true
env:
GH_TOKEN: ${{ inputs.github_token }}
- name: List cache entries
shell: bash
run: |
echo "= Voiceover Cache ="
ls -la episodes/${{ inputs.episode }}-*/voiceovers || true
echo
echo "= Videos Cache ="
ls -la output/${{ inputs.episode }}-*/videos || true
- name: Save episode voiceover cache
if: steps.screenkit.outputs.result == 'true'
uses: actions/cache/save@v5
with:
path: episodes/${{ inputs.episode }}-*/voiceovers
key: ${{ env.VOICEOVER_CACHE_KEY }}
enableCrossOsArchive: true
- name: Save video recordings cache
if: steps.screenkit.outputs.result == 'true'
uses: actions/cache/save@v5
with:
path: output/${{ inputs.episode }}-*/videos/*.mp4
key: ${{ env.VIDEO_CACHE_KEY }}
enableCrossOsArchive: true
- name: Upload output artifacts
uses: actions/upload-artifact@v7
if: always()
with:
name: output
path: output
retention-days: ${{ inputs.retention }}