From d40844b00555dfe78078b636262af9f02048dcc1 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sat, 6 Nov 2021 16:57:14 +0000 Subject: [PATCH] Fix bundle analyzer workflow (#4060) * try again * maybe build * the rest * add cache back in --- .github/workflows/nextjs_bundle_analysis.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nextjs_bundle_analysis.yml b/.github/workflows/nextjs_bundle_analysis.yml index 70fe68216..4cc3b7f7c 100644 --- a/.github/workflows/nextjs_bundle_analysis.yml +++ b/.github/workflows/nextjs_bundle_analysis.yml @@ -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'}"