-
Notifications
You must be signed in to change notification settings - Fork 11
80 lines (80 loc) · 2.32 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
name: deploy
on:
push:
branches:
- deploy/site
# trigger after a scheduled run of the benchmarks
workflow_run:
workflows: [benchmark]
branches: [main]
types: [completed]
jobs:
deploy:
runs-on: ubuntu-22.04
permissions:
actions: read
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright
- name: prereqs
run: |
pip install --disable-pip-version-check sqlite-utils csv2md shot-scraper
shot-scraper install
- name: average stats
run: |
./bin/generate_average_stats.sh
csv2md stats.csv >> $GITHUB_STEP_SUMMARY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: dependencies
run: npm ci
working-directory: site
- name: build site
working-directory: site
run: |
set -ex
./csv_to_json.py ../stats.csv > data.json
npm run build
python -m http.server --directory dist &
PID=$!
sleep 1
shot-scraper http://localhost:8000 -s '#install-chart' --width 1200 --height 675 --padding 10 -o ogimage.png
kill $PID
npm run build
tar -cf /tmp/dist.tar -C dist .
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: push
run: |
set -ex
git config user.name "GitHub Actions"
git config user.email "<>"
rm -rf ./*
tar -xf /tmp/dist.tar
git add -A
# If there's nothing new, commit will fail expectedly.
# This prevents that from also failing the workflow.
git commit -m "gh pages" && git push origin gh-pages || echo "Unable to commit/push"