-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (73 loc) · 2.37 KB
/
www.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
name: GitHub Pages
on:
push:
branches:
- www
workflow_dispatch:
jobs:
build:
name: Build + deploy www branch to ctbk.dev via GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.WWW_DEPLOY_KEY }}
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: www/pnpm-lock.yaml
- name: Install
working-directory: www
run: |
pnpm install
pnpm up puppeteer
- name: Build
working-directory: www
run: |
pnpm run build
touch out/.nojekyll
- name: Serve Files
uses: Eun/http-server-action@v1.0.6
with:
directory: www/out
index-files: |
["index.html", "index.htm"]
- name: Install chrome
run: pnpx puppeteer browsers install chrome
- name: Inspect puppeteer cache
run: tree -L 3 ~/.cache/puppeteer
- name: Run puppeteer install script
run: node node_modules/.pnpm/puppeteer\@22.8.0_typescript\@4.9.5/node_modules/puppeteer/install.mjs
- name: Inspect puppeteer cache
run: tree -L 3 ~/.cache/puppeteer
- name: Regenerate screenshots
working-directory: www
run: node screenshots.js -h localhost:8080 -l 120000
- name: Push + re-run, if screenshots changed
id: screenshots
run: |
if git diff --name-only -- www/public/screenshots | grep -v ctbk-stations; then
git add www/public/screenshots
git config --global user.name "GitHub Actions"
git config --global user.email "github@actions"
git commit -m "Update screenshots"
git pull origin www
echo "Pushing www"
git push origin HEAD:www
echo "Updating main branch"
git fetch --unshallow origin main
git pull origin main
git push origin HEAD:main
echo "REGENERATED=true" >> $GITHUB_OUTPUT
fi
- name: Deploy to GH Page
uses: JamesIves/github-pages-deploy-action@4.1.1
if: steps.screenshots.outputs.REGENERATED != 'true'
with:
branch: ghp
folder: www/out