Skip to content

Commit 3d03a44

Browse files
committed
fix: update performance-check job to build independently instead of downloading artifacts
1 parent d5eafe6 commit 3d03a44

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,37 +305,50 @@ jobs:
305305
306306
# 性能检查作业
307307
performance-check:
308-
needs: build-and-test
309308
runs-on: ubuntu-latest
310309
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
311310
permissions:
312311
contents: read
313312

314313
steps:
315-
- name: Download build artifacts
316-
uses: actions/download-artifact@v4
314+
- name: Checkout repository
315+
uses: actions/checkout@v4
316+
317+
- name: Setup Node.js
318+
uses: actions/setup-node@v4
317319
with:
318-
name: github-pages
319-
path: ./site-build
320+
node-version: "20"
321+
cache: "npm"
322+
cache-dependency-path: "./src/package-lock.json"
323+
324+
- name: Install dependencies
325+
run: npm ci --prefer-offline --no-audit
326+
working-directory: ./src
327+
328+
- name: Build site
329+
run: npm run build
330+
env:
331+
NODE_ENV: production
332+
working-directory: ./src
320333

321334
- name: Check build size
322335
run: |
323-
BUILD_SIZE=$(du -sh ./site-build | cut -f1)
336+
BUILD_SIZE=$(du -sh ./src/public | cut -f1)
324337
echo "📊 Build size: $BUILD_SIZE"
325338
326339
# 检查是否有过大的文件
327-
LARGE_FILES=$(find ./site-build -type f -size +1M | wc -l)
340+
LARGE_FILES=$(find ./src/public -type f -size +1M | wc -l)
328341
if [ $LARGE_FILES -gt 0 ]; then
329342
echo "⚠️ Found $LARGE_FILES files larger than 1MB"
330-
find ./site-build -type f -size +1M -exec ls -lh {} \;
343+
find ./src/public -type f -size +1M -exec ls -lh {} \;
331344
else
332345
echo "✅ No large files detected"
333346
fi
334347
335348
- name: Check for broken links (basic)
336349
run: |
337350
# 简单的链接检查
338-
HTML_FILES=$(find ./site-build -name "*.html" | head -5)
351+
HTML_FILES=$(find ./src/public -name "*.html" | head -5)
339352
for file in $HTML_FILES; do
340353
echo "Checking $file..."
341354
grep -o 'href="[^"]*"' "$file" | head -3 || true

0 commit comments

Comments
 (0)