-
Notifications
You must be signed in to change notification settings - Fork 8
46 lines (39 loc) · 1.15 KB
/
generate-critical-css.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
name: Generate Critical CSS
# Run on pull requests to main
on:
pull_request:
branches: [main]
jobs:
generate-critical-css:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
submodules: true # Fetch Hugo themes
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install npm
run: npm install
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.136.2'
extended: true
- name: Build
run: hugo --minify --buildDrafts=true
- run: npm install
- name: Run critical script file
run: |
chmod +x ./critical-css.sh
./critical-css.sh
shell: bash
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: 'Update critical CSS'
add: 'assets/css/critical.css'