Skip to content

Commit 086bac9

Browse files
committed
Add a workflow to generate folder images
This workflow will generate a bunch of images and place them on a branch called "folder-images", which (once enabled via github pages) will appear on adafruit.github.io. The workflow is triggered: * on commits to the main branch, including merged pull requests * daily, after the bundle is updated * on request via the github web page Typically, this means that the images will be available (well) within an hour after a pull request is merged, and will be updated daily if required by changes to the requirements of libraries.
1 parent f4bc335 commit 086bac9

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/images.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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/[email protected]
24+
25+
- name: Set up Python 3.9
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: 3.9
29+
30+
- name: Checkout screenshot maker
31+
run: git clone --depth=1 https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker
32+
33+
- name: Install dependencies
34+
run: pip install -r CircuitPython_Library_Screenshot_Maker/requirements.txt
35+
36+
- name: Generate images
37+
run: |
38+
cd CircuitPython_Library_Screenshot_Maker
39+
env LEARN_GUIDE_REPO=../ python3 ./create_requirement_images.py
40+
41+
- name: Commit updates
42+
run: |
43+
cd CircuitPython_Library_Screenshot_Maker/generated_images
44+
git config --global user.name "${GITHUB_ACTOR} (github actions cron)"
45+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
46+
git config --global init.defaultBranch main
47+
git init
48+
for i in *.png; do echo "<a href=\"$i\">$i</a><br>"; done > index.html
49+
git add *.png index.html
50+
git remote add origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
51+
if git commit -m"update images"; then git push -f origin HEAD:folder-images; fi
52+

0 commit comments

Comments
 (0)