[Video] Autogenerated and Deploy Videos #551
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "[Video] Autogenerated and Deploy Videos" | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# We'll run this daily at noon. | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
jobs: | |
runner-job: | |
if: github.repository_owner == 'galaxyproject' | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
mozillatts: | |
image: synesthesiam/mozillatts | |
ports: | |
- 5002:5002 | |
steps: | |
# Shallow should be fine for video | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5000 | |
# BEGIN Dependencies | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.7' | |
architecture: 'x64' | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
vendor/bundle | |
~/.npm | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node- | |
${{ runner.os }}-gems- | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
npm install | |
bundle pristine ffi | |
# END Dependencies | |
- name: Install rendering stuff | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb libfontconfig ghostscript ffmpeg | |
- name: Change ImageMagick policy to allow pdf->png conversion. | |
run: | | |
sudo rm /etc/ImageMagick-6/policy.xml | |
- name: Build Site | |
run: | | |
gem install bundler | |
JEKYLL_ENV=production bundle exec jekyll build --strict_front_matter -d _site/training-material | |
# We get the previous build ID to know how many videos were changed since | |
# then. | |
# | |
# We *could* fetch the diff in the past N days but if a build fails for | |
# any reason, we'd lose those changes permanently and things would never | |
# get built. | |
# | |
# So instead we just track the last successfully built git commit. | |
- name: Previous build ID | |
id: build_id | |
run: | | |
echo "commit=$(curl https://galaxy-training.s3.amazonaws.com/videos/topics/last-commit -f 2>/dev/null || echo none)" >> $GITHUB_ENV | |
# The actual compilation process deposits everything in the ./videos/ folder. | |
- name: Build Videos | |
run: | | |
# Override permissions on _site to allow docker access. | |
chmod -R ugo+rwx _site | |
# Then we can build the slides | |
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" bundle exec bash bin/ari-make.sh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_POLLY_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_POLLY_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
PREVIOUS_COMMIT_ID: ${{ env.commit }} | |
# Deploy step, scary. | |
- uses: jakejarvis/[email protected] | |
with: | |
args: --acl public-read --follow-symlinks | |
env: | |
AWS_S3_BUCKET: galaxy-training | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: './videos/topics/' | |
DEST_DIR: 'videos/topics/' |