Skip to content

Autogenerated and Deploy Videos #794

Autogenerated and Deploy Videos

Autogenerated and Deploy Videos #794

Workflow file for this run

name: 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: 0
# BEGIN Dependencies
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
- 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 "::set-output name=commit::$(curl https://galaxy-training.s3.amazonaws.com/videos/topics/last-commit -f 2>/dev/null || echo none)"
# The actual compilation process deposits everything in the ./videos/ folder.
- name: Build Videos
run: |
sed -i "s|page.waitForNavigation({ waitUntil: 'load', timeout: 20000 });|page.waitForNavigation({ waitUntil: 'load', timeout: 60000 });|" $(npm bin)/decktape
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: ${{ steps.build_id.outputs.commit }}
# Deploy step, scary.
- uses: jakejarvis/s3-sync-action@v0.5.1
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/'