Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
galaxyproject
GitHub Repository: galaxyproject/training-material
Path: blob/main/bin/ari-make.sh
1677 views
1
#!/bin/bash
2
set -e
3
4
function cleanup(){
5
kill $(pgrep -f $(npm bin)/http-server) || true
6
}
7
8
trap cleanup EXIT
9
10
# We have an old commit ID, so we need to figure out which slides to build.
11
videos="$(find topics -name 'slides.html' -or -name 'slides_*ES.html')"
12
if [[ "${PREVIOUS_COMMIT_ID}" != "none" ]]; then
13
changed_slides="$(join <(echo "$videos" | xargs ./bin/filter-resource-metadata video | sort) <(git diff ${PREVIOUS_COMMIT_ID} --name-only | sort))"
14
else
15
changed_slides="$(echo "$videos" | xargs ./bin/filter-resource-metadata video)"
16
fi
17
18
./node_modules/.bin/http-server -p 9876 _site &
19
20
for slides in $changed_slides; do
21
echo "====== $slides ======"
22
dir="$(dirname "$slides")"
23
pdf="$dir/$(basename "$slides" .html).pdf"
24
mp4="videos/$dir/$(basename "$slides" .html).mp4"
25
built_slides="_site/training-material/$slides"
26
27
# Process the slides
28
echo $built_slides
29
docker run --rm --network host -v $(pwd):/slides astefanutti/decktape:3.9 automatic -s 1920x1080 http://127.0.0.1:9876/training-material/$slides /slides/_site/training-material/$pdf
30
31
# Build the slides
32
echo ari.sh "_site/training-material/$pdf" "$slides" "$mp4"
33
./bin/ari.sh "_site/training-material/$pdf" "$slides" "$mp4"
34
done
35
36
cleanup
37
38
39
# Now we'll note our current, changed commit since this all went so well.
40
mkdir -p videos/topics/
41
git log -1 --format=%H > videos/topics/last-commit
42
43