Skip to content

Commit be7089e

Browse files
authored
Merge pull request #2 from shugaoye/master
build(ci): 调整静态站点构建部署配置
2 parents cd71206 + 58b1aff commit be7089e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/deploy-static.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
- name: Install dependencies
2121
run: npm install
2222

23+
- name: Create .env file
24+
run: |
25+
echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> .env
26+
echo "VITE_APP_TITLE=${{ secrets.VITE_APP_TITLE }}" >> .env
27+
echo "VITE_PROXY_PATH=${{ secrets.VITE_PROXY_PATH }}" >> .env
28+
echo "VITE_PROXY_TARGET_URL=${{ secrets.VITE_PROXY_TARGET_URL }}" >> .env
29+
2330
- name: Build static assets
2431
run: npm run build:static
2532

vite.static.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { viteStaticCopy } from "vite-plugin-static-copy";
55
import fs from "node:fs";
66
import path from "node:path";
77

8-
const env = loadEnv("", process.cwd(), "");
8+
const env = loadEnv("", process.cwd(), "VITE");
99

1010
function existsSync(relativePath: string): boolean {
1111
return fs.existsSync(path.resolve(process.cwd(), relativePath));
@@ -28,7 +28,7 @@ if (existsSync("../docs")) {
2828
}
2929

3030
export default defineConfig({
31-
base: "/app/",
31+
base: "/",
3232
plugins: [
3333
tanstackRouter({
3434
target: "react",

0 commit comments

Comments
 (0)