Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K6897PWcUEwHiqZMcVnNF6
51 lines
2.3 KiB
YAML
51 lines
2.3 KiB
YAML
name: shots
|
|
# Render shots/desktop.png (the venture-list card image on yolopreneur.lol) from this repo's own index.html with
|
|
# headless Chromium, and commit it when it changed. Same recipe as Time's refresh workflow; Playwright's Chromium is
|
|
# installed when the runner has no Chrome.
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths: [index.html, brain.js, favicon.svg, manifest.json, icons/icon.svg, tools/shots.sh, tools/icons.py]
|
|
permissions:
|
|
contents: write
|
|
concurrency:
|
|
group: shots
|
|
cancel-in-progress: true
|
|
jobs:
|
|
shots:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- name: find Chrome, or install Playwright's Chromium
|
|
run: |
|
|
set -eu
|
|
for c in google-chrome google-chrome-stable chromium chromium-browser; do
|
|
if command -v "$c" >/dev/null 2>&1; then echo "CHROME=$(command -v "$c")" >> "$GITHUB_ENV"; exit 0; fi
|
|
done
|
|
npx -y playwright@1.55.0 install --with-deps chromium > /tmp/pw.log 2>&1 || { tail -20 /tmp/pw.log; exit 1; }
|
|
c=$(find "$HOME/.cache/ms-playwright" -type f -name chrome -path '*chrome-linux*' | head -1)
|
|
[ -n "$c" ] && [ -x "$c" ] || { echo "::error::no Chromium after the install"; exit 1; }
|
|
echo "CHROME=$c" >> "$GITHUB_ENV"
|
|
- name: shoot
|
|
env:
|
|
CHROME_FLAGS: "--no-sandbox --disable-dev-shm-usage --disable-gpu"
|
|
run: sh tools/shots.sh
|
|
- name: stamp the service worker
|
|
run: sed -i "s/^const REV = \".*\";/const REV = \"${GITHUB_SHA::12}\";/" sw.js && grep '^const REV' sw.js
|
|
- name: commit
|
|
run: |
|
|
set -eu
|
|
git add shots/desktop.png icons/icon-512.png icons/icon-192.png icons/apple-touch-icon.png sw.js
|
|
if git diff --cached --quiet; then echo "shots unchanged"; exit 0; fi
|
|
git -c user.name='gitea-actions[bot]' -c user.email='gitea-actions[bot]@users.noreply.teahub.xyz' commit -q -m "shots + sw stamp ${GITHUB_SHA::12}"
|
|
git push -q origin HEAD:main
|
|
- name: tell Teahub pages to pull
|
|
run: curl -fsS -X POST "https://gandora.yolopreneur.lol/_hook/gandora/site" || echo "pages pulls by itself within five minutes"
|