ci(project): compressed actions for PRs (#6547)

* ci(project): compressed actions for PRs

- Introduce compressed size checking action for PRs
- Update package.json with a clean:lockfile script for the action

* Fix pnpm not found
This commit is contained in:
JeremyWuuuuu
2022-03-11 22:56:05 +08:00
committed by GitHub
parent da6d2dc84b
commit d57cc0d974
2 changed files with 42 additions and 0 deletions

41
.github/workflows/size-report.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: 📦 Package Size Report
on:
pull_request:
types: [opened, synchronize]
jobs:
size-report:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Cache ~/.pnpm-store
uses: actions/cache@v2
env:
cache-name: cache-pnpm-store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-publish-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-publish-${{ env.cache-name }}-
${{ runner.os }}-publish-
${{ runner.os }}-
- uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: './dist/element-plus/dist/*.{js,mjs,css}'
clean-script: 'clean:lockfile'

View File

@@ -24,6 +24,7 @@
"update:version": "sucrase-node scripts/update-version.ts",
"clean": "pnpm run clean:dist && pnpm run clean -r --stream",
"clean:dist": "rimraf dist",
"clean:lockfile": "rm -f pnpm-lock.yaml",
"build": "gulp --require sucrase/register/ts -f build/gulpfile.ts",
"build:theme": "pnpm run build -C packages/theme-chalk",
"format": "prettier --write .",