Skip to content

Commit 4e7f38e

Browse files
committed
Update build action: echo into .env.production
1 parent 27ae8bc commit 4e7f38e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
cache: 'npm'
3838
- name: Install dependencies
3939
run: npm ci
40+
- name: Setup .env.production
41+
run: echo "VITE_IS_GITHUB=true" >> .env.production
4042
- name: Build
41-
env:
42-
GITHUB: "yes"
4343
run: npm run build
4444
- name: Setup Pages
4545
uses: actions/configure-pages@v5

vite.config.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ import path from "node:path";
44

55
declare global {
66
interface ImportMeta {
7-
env: {
8-
GITHUB: string;
9-
}
7+
env: undefined | Record<`VITE_${string}`, string | undefined>;
108
}
119
}
1210
// https://vitejs.dev/config/
1311
export default defineConfig(() => {
14-
console.log("GITHUB:", import.meta.env?.GITHUB);
15-
16-
const base = import.meta.env?.GITHUB !== undefined
12+
console.log("env:", import.meta.env);
13+
console.log("GITHUB:", import.meta.env?.VITE_IS_GITHUB);
14+
15+
const base = import.meta.env?.VITE_IS_GITHUB === "true"
1716
? "/SkapEdit/"
1817
: "/";
1918
console.log("Base:", base);

0 commit comments

Comments
 (0)