Skip to content

Generate Video

Generate Video #688

Workflow file for this run

name: Generate Video
on:
schedule:
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
generate-video:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v1-beta
id: setup-ffmpeg
- name: Generate Video
run: ffmpeg -y -framerate 10 -pattern_type glob -i "images/*.jpg" -c:v libx264 -crf 0 ./videos/video.mp4
- name: Generate Gif
run: ffmpeg -y -i ./videos/video.mp4 -vf scale=800:-1 -r 10 ./gif/animation.gif
# - name: Generate HD Gif
# run: ffmpeg -y -i ./videos/video.mp4 -vf scale=2304:-1 -r 10 ./gif/animation-HD.gif
- name: Check to see if a new video file has been created
id: changes
run: |
git add -N .
echo "::set-output name=count::$(git diff --name-only | wc -l)"
- name: Commit files
run: |
rm -rf ./videos/video.mp4
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add ./gif/animation.gif
git commit -m "Video Generated, Automated" -a
if: steps.changes.outputs.count > 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
if: steps.changes.outputs.count > 0