images.yml
1 name: Generate folder images 2 3 on: 4 schedule: 5 - cron: '0 10 * * *' 6 workflow_dispatch: 7 push: 8 branches: [master] 9 10 concurrency: 11 group: folder-images 12 cancel-in-progress: true 13 14 jobs: 15 update-images: 16 runs-on: ubuntu-20.04 17 steps: 18 - name: Dump GitHub context 19 env: 20 GITHUB_CONTEXT: ${{ toJson(github) }} 21 run: echo "$GITHUB_CONTEXT" 22 23 - uses: actions/checkout@v2.2.0 24 25 - name: checkout submodules 26 run: git submodule update --init --jobs 16 --depth 1 27 - name: Set up Python 3.9 28 uses: actions/setup-python@v1 29 with: 30 python-version: 3.9 31 32 - name: Checkout screenshot maker 33 run: git clone --depth=1 https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker 34 35 - name: Install dependencies 36 run: pip install -r CircuitPython_Library_Screenshot_Maker/requirements.txt 37 38 - name: Generate images 39 run: | 40 find libraries -path "libraries/*/examples/*.py" -exec python3 CircuitPython_Library_Screenshot_Maker/create_requirement_images.py bundle {} + 41 42 - name: Commit updates 43 run: | 44 cd generated_images 45 git config --global user.name "${GITHUB_ACTOR} (github actions cron)" 46 git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" 47 git config --global init.defaultBranch main 48 git init 49 for i in *.png; do echo "<a href=\"$i\">$i</a><br>"; done > index.html 50 git add *.png index.html 51 git remote add origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} 52 if git commit -m"update images"; then git push -f origin HEAD:folder-images; fi 53