Skip to content

Commit 96c5f12

Browse files
Add GitHub Actions workflow for rendering demo images automatically on main branch updates
1 parent 489261b commit 96c5f12

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/render-demos.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Render demos
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "configs/.pymolrc"
8+
- "configs/.pymolrc.py"
9+
workflow_dispatch:
10+
11+
jobs:
12+
render:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Setup Miniconda
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
miniforge-variant: Mambaforge
25+
channels: conda-forge,defaults
26+
channel-priority: strict
27+
28+
- name: Install PyMOL and Xvfb
29+
shell: bash -l {0}
30+
run: |
31+
mamba install -y pymol-open-source xvfb-run
32+
33+
- name: Render demos
34+
shell: bash -l {0}
35+
env:
36+
PYMOLRC: ${{ github.workspace }}/configs/.pymolrc
37+
run: |
38+
mkdir -p assets
39+
for pml in scripts/demos/*.pml; do
40+
name=$(basename "$pml" .pml)
41+
echo "Rendering $name..."
42+
xvfb-run -a pymol -cqxi "$pml"
43+
done
44+
ls -la assets/
45+
46+
- name: Commit rendered PNGs
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "github-actions[bot]@users.noreply.github.com"
50+
git add assets/*.png
51+
if git diff --staged --quiet; then
52+
echo "No PNG changes"
53+
else
54+
git commit -m "chore: re-render demos after config update"
55+
git push origin HEAD:${{ github.ref }}
56+
fi

0 commit comments

Comments
 (0)