1
- name : ' Next.js Bundle Analysis'
1
+ name : ' Bundle Analysis'
2
2
3
3
on :
4
4
pull_request :
36
36
yarn install --frozen-lockfile 2>&1 | grep -v '^[warning|info]'
37
37
yarn build:lib
38
38
39
- - name : Change dir to next app
40
- run : cd examples/bundle-test
41
-
42
39
- name : Restore next build
43
40
uses : actions/cache@v2
44
41
id : restore-build-cache
@@ -47,32 +44,34 @@ jobs:
47
44
with :
48
45
# if you use a custom build directory, replace all instances of `.next` in this file with your build directory
49
46
# ex: if your app builds to `dist`, replace `.next` with `dist`
50
- path : .next/cache
47
+ path : ./examples/bundle-test/. next/cache
51
48
# change this if you prefer a more strict cache
52
49
key : ${{ runner.os }}-build-${{ env.cache-name }}
53
50
54
51
- name : Build next.js app
52
+ working-directory : ./examples/bundle-test
55
53
# change this if your site requires a custom build command
56
54
run : yarn build
57
55
58
56
# Here's the first place where next-bundle-analysis' own script is used
59
57
# This step pulls the raw bundle stats for the current bundle
60
58
- name : Analyze bundle
59
+ working-directory : ./examples/bundle-test
61
60
run : npx -p nextjs-bundle-analysis report
62
61
63
62
- name : Upload bundle
64
63
uses : actions/upload-artifact@v2
65
64
with :
66
65
name : bundle
67
- path : .next/analyze/__bundle_analysis.json
66
+ path : ./examples/bundle-test/. next/analyze/__bundle_analysis.json
68
67
69
68
- name : Download base branch bundle stats
70
69
uses : dawidd6/action-download-artifact@v2
71
70
if : success() && github.event.number
72
71
with :
73
72
workflow : nextjs_bundle_analysis.yml
74
73
branch : ${{ github.event.pull_request.base.ref }}
75
- path : .next/analyze/base
74
+ path : ./examples/bundle-test/. next/analyze/base
76
75
77
76
# And here's the second place - this runs after we have both the current and
78
77
# base branch bundle stats, and will compare them to determine what changed.
@@ -88,10 +87,12 @@ jobs:
88
87
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
89
88
# entry in your package.json file.
90
89
- name : Compare with base branch bundle
90
+ working-directory : ./examples/bundle-test
91
91
if : success() && github.event.number
92
92
run : ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
93
93
94
94
- name : Get comment body
95
+ working-directory : ./examples/bundle-test
95
96
id : get-comment-body
96
97
if : success() && github.event.number
97
98
run : |
0 commit comments