Run Poster Generate #108
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: Run Poster Generate | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
# please change to your own config. | |
# this actions generate only this year | |
# If you fork this please change the type to yours below | |
TYPE: "strava, github, forest, pass, bbdc" # support strava/gpx/ns/cichang/shanbay/duolingo/issue/leetcode/twitter/github/gitlab/kindle/bilibili/wakatime/dota2/forest, Please change the 'pass' it to your own separated by commas | |
ME: kmq116 | |
jobs: | |
sync: | |
name: Sync | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
# from https://github.com/pdm-project/pdm/blob/main/.github/workflows/ci.yml | |
- name: Set Variables | |
id: set_variables | |
shell: bash | |
run: | | |
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT | |
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache PIP | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.set_variables.outputs.PIP_CACHE }} | |
key: ${{ runner.os }}-pip-${{ steps.set_variables.outputs.PY }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
if: steps.pip-cache.outputs.cache-hit != 'true' | |
- name: Run BBDC script | |
if: contains(env.TYPE, 'bbdc') | |
run: | | |
python -m github_poster bbdc --bbdc_user_id ${{secrets.BBDC_USERID}} --bbdc_type word --me ${{ env.ME }} | |
- name: Mv svg files to examples | |
# only for me to show | |
if: github.repository_owner == 'kmq116' | |
run: mv OUT_FOLDER/*.svg examples/ | |
- name: Push new postger | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m 'update new poster' || echo "nothing to commit" | |
git push || echo "nothing to push" |