Skip to content

Commit a5cf357

Browse files
fix: upgrade puppeteer to 24.x + enable caching in GH Actions workflows
1 parent a6b109b commit a5cf357

6 files changed

Lines changed: 544 additions & 149 deletions

File tree

.github/workflows/build.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
run: |
4545
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
4646
47+
- name: Enable Puppeteer cache
48+
uses: actions/cache@v4
49+
with:
50+
path: .cache/puppeteer
51+
key: puppeteer-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
4753
- name: Enable pnpm cache
4854
uses: actions/cache@v4
4955
with:
@@ -62,10 +68,10 @@ jobs:
6268
run: |
6369
pnpm install
6470
65-
# XXX: Workaround for Puppeteer issues
6671
- name: Install Chromium for Puppeteer
6772
run: |
68-
node ./packages/docs-builder/node_modules/puppeteer/install.js
73+
# Note: This will be a no-op if Chromium was already saved to the Puppeteer cache
74+
pnpm dlx puppeteer browsers install
6975
7076
- name: Build
7177
id: build

.github/workflows/release.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ jobs:
5858
# restore-keys: |
5959
# pnpm-store-${{ runner.os }}-
6060

61+
- name: Enable Puppeteer cache
62+
uses: actions/cache@v4
63+
with:
64+
path: .cache/puppeteer
65+
key: puppeteer-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
66+
6167
# Save the auth token so that the build can access private packages from
6268
# (and publish packages to) the GitHub Packages registry
6369
- name: Configure npm auth tokens
@@ -68,10 +74,10 @@ jobs:
6874
run: |
6975
pnpm install
7076
71-
# XXX: Workaround for Puppeteer issues
7277
- name: Install Chromium for Puppeteer
7378
run: |
74-
node ./packages/docs-builder/node_modules/puppeteer/install.js
79+
# Note: This will be a no-op if Chromium was already saved to the Puppeteer cache
80+
pnpm dlx puppeteer browsers install
7581
7682
- name: Build
7783
id: build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
.cache
2+
.claude/**/*.local.json
13
node_modules

.puppeteerrc.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { join } = require('path')
2+
3+
/**
4+
* @type {import("puppeteer").Configuration}
5+
*/
6+
module.exports = {
7+
// Use a local cache directory to make it easier to persist the cache in GitHub Actions
8+
cacheDirectory: join(__dirname, '.cache', 'puppeteer')
9+
}

packages/docs-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"marked": "^4.0.10",
4646
"postcss": "^8.5.6",
4747
"postcss-rtlcss": "^5.7.1",
48-
"puppeteer": "^18.2.1",
48+
"puppeteer": "^24.0.0",
4949
"rev-hash": "^3.0.0",
5050
"semver-compare": "^1.0.0",
5151
"tinyglobby": "^0.2.15"

0 commit comments

Comments
 (0)