This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Render Image #180
This file contains hidden or 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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Render Image | |
on: | |
schedule: | |
- cron: '0 9 * * 3' # Runs at 03:00 UTC on Mon. | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
# - name: Install Chrome | |
# run: | | |
# sudo rm -rf ~/.config/google-chrome | |
# sudo apt-get update | |
# sudo apt-get remove google-chrome-stable chromium-driver | |
# cat bin/google* > chrome.deb | |
# sudo dpkg -i chrome.deb | |
# cat bin/d-chrome* > chromedriver | |
- name: Render | |
run: | | |
python update_and_render.py | |
- name: Compress | |
run: | | |
sudo apt update | |
sudo apt install pngquant -y | |
pngquant --quality 65-85 --strip --speed 1 ranking.png --output ranking_compressed.png --force | |
mv ranking_compressed.png ranking.png | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action[Bot]" | |
git add -A | |
git commit -m "[`date +\"%Y-%m-%d\"`] Render latest image" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |