-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (47 loc) · 1.52 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
name: Build + Deploy to GitHub Pages
on:
push:
branches:
- www
workflow_call:
workflow_dispatch:
jobs:
run:
name: Build + Deploy to GitHub Pages (iff www/ has changed since last gh-pages push)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- run: git fetch origin gh-pages
- id: base-sha
run: echo "BASE_SHA=$(./parse-ghp-base-sha.py -d root origin/gh-pages)" >> $GITHUB_OUTPUT
- name: Check whether www was changed
id: www-changed
env:
BASE_SHA: ${{ steps.base-sha.outputs.BASE_SHA }}
run: |
echo "BASE_SHA: $BASE_SHA"
git fetch --depth 1 origin $BASE_SHA
echo "WWW_CHANGED=$([ $BASE_SHA != 'root' ] && git diff --quiet $BASE_SHA && echo '' || echo 'true')" >> $GITHUB_OUTPUT
- run: |
echo "WWW_CHANGED: ${{ steps.www-changed.outputs.WWW_CHANGED }}"
- if: steps.www-changed.outputs.WWW_CHANGED
uses: actions/setup-node@v3
with:
node-version: 19
cache: 'pnpm'
cache-dependency-path: www/pnpm-lock.yaml
- if: steps.www-changed.outputs.WWW_CHANGED
name: pnpm install, build, export
run: |
cd www
pnpm install
pnpm run gha-export
- if: steps.www-changed.outputs.WWW_CHANGED
name: Deploy to GH Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: www/out