From 70c127d5ad4c6320e4ae1b53e457b77777bd926a Mon Sep 17 00:00:00 2001 From: sanbuphy Date: Mon, 12 Jan 2026 21:24:37 +0800 Subject: [PATCH] ci: simplify vite build command and update base path Remove repository name extraction from build command and update base path to '/easy-vibe/' Add rollup options for hashed filenames to ensure cache busting --- .github/workflows/deploy.yml | 4 +--- docs/.vitepress/config.mjs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2308854..7d03b25 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,9 +40,7 @@ jobs: run: npm ci - name: Build with VitePress run: | - REPO_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') - echo "Building for repository: $REPO_NAME" - npm run build -- --base /$REPO_NAME/ + npm run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index a9dbecd..b757778 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -1,11 +1,23 @@ import { defineConfig } from 'vitepress' export default defineConfig({ - base: '/', + vite: { + build: { + rollupOptions: { + output: { + // 强制哈希文件名,确保每次构建都是新文件 + entryFileNames: 'assets/[name].[hash].js', + chunkFileNames: 'assets/[name].[hash].js', + assetFileNames: 'assets/[name].[hash].[ext]' + } + } + } + }, + base: '/easy-vibe/', title: 'Easy-Vibe Tutorial', description: 'Easy-Vibe 中文实战课 - 零基础学会用 AI 干实际工作', head: [ - ['link', { rel: 'icon', href: '/logo.png' }] + ['link', { rel: 'icon', href: '/easy-vibe/logo.png' }] ], themeConfig: { logo: '/logo.png',