Skip to content

Commit 7a804ef

Browse files
committed
feat: github webpage deploy workflow
1 parent 1bc9101 commit 7a804ef

File tree

2 files changed

+57
-19
lines changed

2 files changed

+57
-19
lines changed

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v2
24+
with:
25+
version: 9
26+
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: Build
31+
run: pnpm build
32+
33+
- name: Deploy
34+
uses: JamesIves/github-pages-deploy-action@v4
35+
with:
36+
folder: dist
37+
branch: gh-pages

vite.config.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import path from 'path';
2-
import { defineConfig, loadEnv } from 'vite';
3-
import react from '@vitejs/plugin-react';
1+
import path from "path";
2+
import { defineConfig, loadEnv } from "vite";
3+
import react from "@vitejs/plugin-react";
44

55
export default defineConfig(({ mode }) => {
6-
const env = loadEnv(mode, '.', '');
7-
return {
8-
server: {
9-
port: 3000,
10-
host: '0.0.0.0',
6+
const env = loadEnv(mode, ".", "");
7+
return {
8+
base: "./",
9+
server: {
10+
port: 3000,
11+
host: "0.0.0.0",
12+
},
13+
plugins: [react()],
14+
define: {
15+
"process.env.API_KEY": JSON.stringify(env.GEMINI_API_KEY),
16+
"process.env.GEMINI_API_KEY": JSON.stringify(env.GEMINI_API_KEY),
17+
},
18+
resolve: {
19+
alias: {
20+
"@": path.resolve(__dirname, "."),
1121
},
12-
plugins: [react()],
13-
define: {
14-
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
15-
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
16-
},
17-
resolve: {
18-
alias: {
19-
'@': path.resolve(__dirname, '.'),
20-
}
21-
}
22-
};
22+
},
23+
};
2324
});

0 commit comments

Comments
 (0)