46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
on:
|
|
push:
|
|
|
|
jobs:
|
|
surge:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
url: ${{ steps.surge_deploy.outputs.url }}
|
|
steps:
|
|
- uses: yanhao98/composite-actions/setup-node-environment@ae9301946790d96f75c7ebe54a34bbaf9f5469d0
|
|
- run: pnpm run build-only
|
|
env:
|
|
VITE_BUILD_COMMIT: ${{ github.sha }}
|
|
- name: 计算构建大小
|
|
run: |
|
|
echo "📊 构建大小统计:"
|
|
echo "----------------------------------------"
|
|
echo "🔹 人类可读格式: $(du -sh dist | cut -f1)"
|
|
echo "🔹 以MB为单位: $(du -sm dist | cut -f1) MB"
|
|
echo "🔹 以KB为单位: $(du -sk dist | cut -f1) KB"
|
|
echo "🔹 文件总数: $(find dist -type f | wc -l) 个文件"
|
|
echo "----------------------------------------"
|
|
- name: 部署到 Surge
|
|
id: surge_deploy
|
|
if: ${{ github.actor != 'nektos/act' }} # https://nektosact.com/usage/index.html#skipping-steps
|
|
uses: yanhao98/composite-actions/deploy-dist-to-surge@ae9301946790d96f75c7ebe54a34bbaf9f5469d0
|
|
playwright:
|
|
needs: surge
|
|
runs-on: ubuntu-latest
|
|
container: yanhao98/runner-images:pnpm-with-playwright
|
|
steps:
|
|
- uses: yanhao98/composite-actions/setup-node-environment@ae9301946790d96f75c7ebe54a34bbaf9f5469d0
|
|
- name: Install Playwright Browsers
|
|
run: pnpm exec playwright install --with-deps
|
|
- name: Run Playwright tests
|
|
run: npx playwright test
|
|
env:
|
|
BASE_URL: ${{ needs.surge.outputs.url }}
|