Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#147 깃허브 액션에 env 추가 #151

Merged
merged 7 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/frontend-dev-CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Dev CI/CD

on:
push:
branches: [ dev ]
branches: [dev]

permissions:
contents: read
Expand All @@ -11,7 +11,7 @@ jobs:
build:
runs-on:
group: Default
labels: [ self-hosted, dev ]
labels: [self-hosted, dev]
permissions:
pull-requests: write

Expand All @@ -29,6 +29,8 @@ jobs:

- name: Run build
run: npm run build
env:
VITE_DOMAIN: ${{ secrets.VITE_DOMAIN_DEV }}

- name: 빌드 파일
run: cp -rf ./dist ~/
run: cp -rf ./dist ~/
10 changes: 6 additions & 4 deletions .github/workflows/frontend-prod-CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Prod CI/CD

on:
push:
branches: [ prod ]
branches: [prod]

permissions:
contents: read
Expand All @@ -11,7 +11,7 @@ jobs:
build:
runs-on:
group: Default
labels: [ self-hosted, dev ]
labels: [self-hosted, dev]
permissions:
pull-requests: write

Expand All @@ -29,12 +29,14 @@ jobs:

- name: Run build
run: npm run build
env:
VITE_DOMAIN: ${{ secrets.VITE_DOMAIN_PROD }}

- name: Copy to Prod Server
uses: appleboy/scp-action@master
with:
username: ${{ secrets.PROD_USER_NAME }}
host: ${{ secrets.PROD_SERVER }}
key: ${{ secrets.PROD_PEM_KEY }}
source: "./dist"
target: "~/"
source: './dist'
target: '~/'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dist-ssr
*.sw?

# env
.env.development
.env
.env.development
2 changes: 1 addition & 1 deletion src/axios/instances.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';

export const DOMAIN = 'dev.mafia-together.com';
export const DOMAIN = import.meta.env.VITE_DOMAIN;
export const BASE_URL = `https://${DOMAIN}/api`;

export const axiosInstance = axios.create({
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from 'react';
import { useRecoilState, useSetRecoilState } from 'recoil';

import { getChats, getGamesInfo, getMyJob } from '../axios/http';
import { BASE_URL } from '../axios/instances';
import { BASE_URL, DOMAIN } from '../axios/instances';
import { gameRound, myJobState, roomInfoState } from '../recoil/roominfo/atom';
import { ChatArray, ChatResponse, GameStatus, SkillResponse, WaitingRoomInfo } from '../type';
import Day from './Day';
Expand Down Expand Up @@ -69,7 +69,7 @@ export default function Game() {
// WebSocket
const connect = () => {
const socket = new StompJs.Client({
brokerURL: `wss://dev.mafia-together.com/api/stomp`,
brokerURL: `wss://${DOMAIN}/api/stomp`,
reconnectDelay: 10000,
});

Expand Down
3 changes: 1 addition & 2 deletions src/pages/WaitingRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Toaster } from 'react-hot-toast';
import { useNavigate } from 'react-router-dom';

import { getRoomsCode, startGame } from '../axios/http';
import { DOMAIN } from '../axios/instances';
import BigButton from '../components/button/BigButton';
import { Loading } from '../components/etc/Loading';
import AppContainerCSS from '../components/layout/AppContainerCSS';
Expand Down Expand Up @@ -71,7 +70,7 @@ export default function WaitingRoom({ waitingRoomInfoState }: PropsType) {

const onShareLink = async () => {
// 링크 공유s
const inviteLink = DOMAIN + '/#/participate?code=' + code;
const inviteLink = '/#/participate?code=' + code;
const shareData = {
url: inviteLink,
};
Expand Down
Loading