Skip to content

bring in work from monorepo #260

bring in work from monorepo

bring in work from monorepo #260

Workflow file for this run

name: Bundle
on:
push:
branches:
- master
pull_request:
env:
PNPM_VERSION: 9
jobs:
base:
runs-on: ubuntu-latest
outputs:
size: ${{ steps.size.outputs.size }}
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v2
with:
cache: "pnpm"
- run: pnpm install
- run: pnpm build
- id: size
run: |
echo "::set-output name=size::$(du -s dist/ | awk '{print $1}')"
- if: ${{ hashFiles('stats.html') != '' }}
run: pnpm dlx surge . https://${{ github.base_ref }}-stats.surge.sh --token ${{ secrets.SURGE_TOKEN }}
head:
runs-on: ubuntu-latest
outputs:
size: ${{ steps.size.outputs.size }}
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v2
with:
cache: "pnpm"
- run: pnpm install
- run: pnpm build
- id: size
run: |
echo "::set-output name=size::$(du -s dist/ | awk '{print $1}')"
- if: ${{ hashFiles('stats.html') != '' }}
run: pnpm dlx surge . https://${{ github.head_ref }}-stats.surge.sh --token ${{ secrets.SURGE_TOKEN }}
compare:
runs-on: ubuntu-latest
needs: [base, head]
if: github.event_name == 'pull_request'
steps:
- id: fc
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Bundle size comparison"
- uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
edit-mode: replace
body: |
### Bundle size comparison
- Base: [${{needs.base.outputs.size}}](https://${{ github.base_ref }}-stats.surge.sh/stats.html)
- Head: [${{needs.head.outputs.size}}](https://${{ github.head_ref }}-stats.surge.sh/stats.html)
- run: |
if [ "${{needs.base.outputs.size}}" -lt "${{needs.head.outputs.size}}" ]; then
exit 1
else
exit 0
fi
bundlewatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v2
with:
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
- env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_REPO_OWNER: ${{ github.repository_owner }}
CI_REPO_CI_COMMIT_SHA: ${{ github.sha }}
CI_BRANCH: ${{ github.ref_name }}
run: pnpm dlx bundlewatch