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
This commit is contained in:
sanbuphy
2026-01-12 21:24:37 +08:00
parent eaac9b5452
commit 70c127d5ad
2 changed files with 15 additions and 5 deletions
+1 -3
View File
@@ -40,9 +40,7 @@ jobs:
run: npm ci run: npm ci
- name: Build with VitePress - name: Build with VitePress
run: | run: |
REPO_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') npm run build
echo "Building for repository: $REPO_NAME"
npm run build -- --base /$REPO_NAME/
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
+14 -2
View File
@@ -1,11 +1,23 @@
import { defineConfig } from 'vitepress' import { defineConfig } from 'vitepress'
export default defineConfig({ 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', title: 'Easy-Vibe Tutorial',
description: 'Easy-Vibe 中文实战课 - 零基础学会用 AI 干实际工作', description: 'Easy-Vibe 中文实战课 - 零基础学会用 AI 干实际工作',
head: [ head: [
['link', { rel: 'icon', href: '/logo.png' }] ['link', { rel: 'icon', href: '/easy-vibe/logo.png' }]
], ],
themeConfig: { themeConfig: {
logo: '/logo.png', logo: '/logo.png',