Update Avatars Gallery for Taichi Repos #1192
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: Update Avatars Gallery for Taichi Repos | |
on: | |
schedule: | |
# update it every day | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
update-avatars: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
architecture: "x64" | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install Dependencies | |
run: | | |
pip install github-avatars-gallery-generator | |
wget https://github.com/sterlp/svg2png/releases/download/v1.1.0/svg2png-1.1.0.jar | |
- name: Generate SVG files and convert them to PNG | |
run: | | |
cd taichi.graphics/ | |
gh-gallery -o taichi-dev -r taichi-docs-zh-cn -a 48 -n 12 --shuffle | |
java -jar ../svg2png-1.1.0.jar -e -f contributors_taichi-dev_taichi-docs-zh-cn_12.svg -n contributors_taichi-dev_taichi-docs-zh-cn_12.png -h 640 | |
cd - | |
cd taichi/ | |
gh-gallery -o taichi-dev -r taichi -a 32 -n 18 --shuffle | |
java -jar ../svg2png-1.1.0.jar -e -f contributors_taichi-dev_taichi_18.svg -n contributors_taichi-dev_taichi_18.png -h 1080 | |
cd - | |
- name: Commit changes | |
run: | | |
git config user.name "Taichi Gardener" | |
git config user.email "taichigardener@gmail.com" | |
git add "*.png" | |
git diff --staged --quiet || git commit -m "Update contributor avatar gallery files." | |
git push |