mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Fix bundle analyzer workflow (#4060)
* try again * maybe build * the rest * add cache back in
This commit is contained in:
19
.github/workflows/nextjs_bundle_analysis.yml
vendored
19
.github/workflows/nextjs_bundle_analysis.yml
vendored
@@ -12,19 +12,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: 'beta'
|
||||
|
||||
- name: Set up node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "14.x"
|
||||
|
||||
- name: Use beta
|
||||
run: cd beta
|
||||
|
||||
- name: Install dependencies
|
||||
uses: bahmutov/npm-install@v1.6.0
|
||||
with:
|
||||
working-directory: 'beta'
|
||||
|
||||
- name: Restore next build
|
||||
uses: actions/cache@v2
|
||||
@@ -32,24 +29,26 @@ jobs:
|
||||
env:
|
||||
cache-name: cache-next-build
|
||||
with:
|
||||
path: .next/cache
|
||||
path: beta/.next/cache
|
||||
# change this if you prefer a more strict cache
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
|
||||
- name: Build next.js app
|
||||
# change this if your site requires a custom build command
|
||||
run: ./node_modules/.bin/next build
|
||||
working-directory: beta
|
||||
|
||||
# Here's the first place where next-bundle-analysis' own script is used
|
||||
# This step pulls the raw bundle stats for the current bundle
|
||||
- name: Analyze bundle
|
||||
run: npx -p nextjs-bundle-analysis report
|
||||
working-directory: beta
|
||||
|
||||
- name: Upload bundle
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: bundle
|
||||
path: .next/analyze/__bundle_analysis.json
|
||||
path: beta/.next/analyze/__bundle_analysis.json
|
||||
|
||||
- name: Download base branch bundle stats
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
@@ -57,7 +56,7 @@ jobs:
|
||||
with:
|
||||
workflow: nextjs_bundle_analysis.yml
|
||||
branch: ${{ github.event.pull_request.base.ref }}
|
||||
path: .next/analyze/base
|
||||
path: beta/.next/analyze/base
|
||||
|
||||
# And here's the second place - this runs after we have both the current and
|
||||
# base branch bundle stats, and will compare them to determine what changed.
|
||||
@@ -74,13 +73,13 @@ jobs:
|
||||
# entry in your package.json file.
|
||||
- name: Compare with base branch bundle
|
||||
if: success() && github.event.number
|
||||
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
|
||||
run: ls -laR beta/.next/analyze/base && npx -p nextjs-bundle-analysis compare
|
||||
|
||||
- name: Get comment body
|
||||
id: get-comment-body
|
||||
if: success() && github.event.number
|
||||
run: |
|
||||
body=$(cat .next/analyze/__bundle_analysis_comment.txt)
|
||||
body=$(cat beta/.next/analyze/__bundle_analysis_comment.txt)
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
|
||||
Reference in New Issue
Block a user