-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (56 loc) · 2.02 KB
/
lighthouse-ci.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
name: lighthouse ci
on: [push]
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
jobs:
build-ci:
name: build site and run lighthouse ci
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Get Hugo version
run: echo "HUGO_VERSION=$(cat .hugo_version)" >> $GITHUB_ENV
- name: setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Get node version from package.json
run: echo "NODE_VERSION=$(cat package.json | jq -r '.volta.node')" >> $GITHUB_ENV
- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: fetch js dependencies from cache
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ hashFiles('package-lock.json') }}
npm-
- name: install js dependencies
run: npm ci
- name: build site
run: hugo --minify
# this step makes the site's built html and css available for download
# from github; see the run in github actions to access it as a zipfile.
# we don't export image derivatives because it makes the build a lot
# slower.
- name: export built files for download
uses: actions/upload-artifact@v3
with:
name: public
path: |
public/
!public/issues/**/images/
# lighthouse is configured using the lighthouserc.js file in the project
# root, see that file for more details. output from runs is uploaded to
# free google cloud storage and accessible via the github action run
- name: audit site using lighthouse ci
uses: treosh/lighthouse-ci-action@v10
with:
configPath: './lighthouserc.js'
uploadArtifacts: true
temporaryPublicStorage: true