chore: version packages (#645) #1370
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) HashiCorp, Inc. | |
# SPDX-License-Identifier: MPL-2.0 | |
name: "Next.js Bundle Analysis" | |
on: | |
pull_request: | |
branches: ["*", "!changeset-release/main"] | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
permissions: | |
contents: read # for checkout repository | |
actions: read # for fetching base branch bundle stats | |
pull-requests: write # for comments | |
env: | |
FORCE_COLOR: 3 | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
jobs: | |
analyze: | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_DB: blobscan_dev | |
POSTGRES_USER: blobscan | |
POSTGRES_PASSWORD: s3cr3t | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./tooling/github/setup | |
- name: Setup DB | |
uses: ./tooling/github/setup-db | |
- name: Build next.js app | |
run: pnpm build --filter=web | |
- name: Analyze bundle | |
run: | | |
cd apps/web | |
npx -p nextjs-bundle-analysis report | |
- name: Upload bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bundle | |
path: apps/web/.next/analyze/__bundle_analysis.json | |
- name: Download base branch bundle stats | |
if: success() && github.event.number | |
run: bash ./scripts/github/download_bundle_analyzer_artifact.sh | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compare with base branch bundle | |
if: success() && github.event.number | |
run: | | |
cd apps/web | |
ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare | |
- name: Get Comment Body | |
id: get-comment-body | |
if: success() && github.event.number | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | |
run: | | |
cd apps/web | |
echo "body<<EOF" >> $GITHUB_OUTPUT | |
echo "$(cat .next/analyze/__bundle_analysis_comment.txt)" >> $GITHUB_OUTPUT | |
echo EOF >> $GITHUB_OUTPUT | |
- name: Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: next-bundle-analysis | |
message: ${{ steps.get-comment-body.outputs.body }} |