File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ jobs:
1919 - name : build
2020 run : |
2121 cd Frontend
22- npm install && npm run build
22+ npm install
23+ if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
24+ npm run build -- --mode production
25+ else
26+ npm run build -- --mode test
27+ fi
2328 - name : Deploy to Server
2429 uses : easingthemes/ssh-deploy@v2.1.5
2530 env :
26- SSH_PRIVATE_KEY : ${{ github.ref == 'refs/heads/master' && secrets.PROD_SSH_PRIVATE_KEY || secrets.DEV_SSH_PRIVATE_KEY }}
31+ SSH_PRIVATE_KEY : ${{ github.ref == 'refs/heads/master' && secrets.PROD_SSH_PRIVATE_KEY || secrets.TEST_SSH_PRIVATE_KEY }}
2732 REMOTE_HOST : ${{ github.ref == 'refs/heads/master' && secrets.PROD_REMOTE_HOST || secrets.TEST_REMOTE_HOST }}
2833 REMOTE_USER : root
2934 SOURCE : Frontend/dist/*
Original file line number Diff line number Diff line change 1+ VITE_API_BASE_URL = http://localhost:8000/
Original file line number Diff line number Diff line change 1+ VITE_API_BASE_URL =
Original file line number Diff line number Diff line change 1+ VITE_API_BASE_URL =
Original file line number Diff line number Diff line change 1- import { defineConfig } from 'vite'
1+ import { defineConfig , loadEnv } from 'vite'
22import vue from '@vitejs/plugin-vue'
33
44import tailwindcss from '@tailwindcss/vite'
55
66// https://vite.dev/config/
7- export default defineConfig ( {
8- plugins : [ vue ( ) , tailwindcss ( ) ] ,
9- resolve : {
10- alias : {
11- '@' : '/src' ,
7+ export default defineConfig ( ( { mode } ) => {
8+ const env = loadEnv ( mode , process . cwd ( ) , '' )
9+
10+ return {
11+ plugins : [ vue ( ) , tailwindcss ( ) ] ,
12+ resolve : {
13+ alias : {
14+ '@' : '/src' ,
15+ } ,
1216 } ,
13- } ,
14- server : {
15- port : 5173 ,
16- proxy : {
17- '/api' : {
18- target : "http://127.0.0.1:8000/" ,
19- changeOrigin : true , //需要代理跨域
20- rewrite : ( path ) => path . replace ( / ^ \/ a p i / , '' ) , //路径重写,把'/api'替换为''
17+ server : {
18+ proxy : {
19+ '/api' : {
20+ target : env . VITE_API_BASE_URL ,
21+ changeOrigin : true , //需要代理跨域
22+ rewrite : ( path ) => path . replace ( / ^ \/ a p i / , '' ) , //路径重写,把'/api'替换为''
23+ } ,
2124 } ,
2225 } ,
23- } ,
24- } )
26+ }
27+ } )
You can’t perform that action at this time.
0 commit comments