diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml new file mode 100644 index 000000000..fd964f9bd --- /dev/null +++ b/.github/workflows/auto-deploy.yml @@ -0,0 +1,69 @@ +name: issue-tracker auto deploy + +on: + push: + branches: [ "fe-release" ] + + +permissions: + contents: read + +env: + FE_WORKING_DIR: ./fe + FE_ENV_PATH: ./.env + FE_DOCKER_FILE_PATH: ./Dockerfile + +jobs: + + # job[2]: FRONTEND -> docker hub로 build & push + fe-deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ env.FE_WORKING_DIR }} + steps: + + # 1. Source 단계 + - name: Checkout Source Code + uses: actions/checkout@v3 + + # Node 세팅 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + + # 2. .env 파일 변경 + - name: create .env File + run: | + echo "${{ secrets.ENV }}" > "${{ env.FE_ENV_PATH }}" + + # 2. 도커파일 생성 + - name: create Docker File + run: | + echo "${{ secrets.FE_DOCKER_FILE }}" > "${{ env.FE_DOCKER_FILE_PATH }}" + + + # 2. docker hub로 build & push + - name: docker build and push + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/team-5-second-hand-fe:latest . + docker push ${{ secrets.DOCKER_USERNAME }}/team-5-second-hand-fe:latest + + # job[4]: EC2에서 docker 이미지 pull하고 실행 + SSH-Transfer: + needs: [ fe-deploy ] + runs-on: ubuntu-latest + steps: + - name: SSH Transfer + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ubuntu + key: ${{ secrets.KEY }} + script: | + sudo docker-compose down -v + sudo docker pull ${{ secrets.DOCKER_USERNAME }}/team-5-second-hand-fe:latest + sudo docker-compose up -d + sudo docker image prune -a -f diff --git a/.gitignore b/.gitignore index 524f0963b..ae32e2ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* replay_pid* + +.idea/ + +.DS_Store diff --git a/fe/src/api/queryKey.tsx b/fe/src/api/queryKey.tsx index 2c9d988a9..ed42a4086 100644 --- a/fe/src/api/queryKey.tsx +++ b/fe/src/api/queryKey.tsx @@ -16,4 +16,4 @@ export const QUERY_KEYS = { CHAT_LIST: (memberId: number) => ['chatList', memberId], CHAT_ROOM: (chatRoomId: number) => ['chatRoom', chatRoomId], LIKE_CATEGORY: (memberId: number) => ['likeCategory', memberId], -}; +}; \ No newline at end of file diff --git a/fe/src/components/ActionBar/PostBar.tsx b/fe/src/components/ActionBar/PostBar.tsx index efbee9300..9ec7f3347 100644 --- a/fe/src/components/ActionBar/PostBar.tsx +++ b/fe/src/components/ActionBar/PostBar.tsx @@ -84,4 +84,4 @@ const Info = styled.div` const Price = styled.span` color: ${({ theme }) => theme.color.neutralTextStrong}; font: ${({ theme }) => theme.font.displayDefault16}; -`; +`; \ No newline at end of file diff --git a/fe/src/constants/endpoints.ts b/fe/src/constants/endpoints.ts index 3f8de4d25..b1c1c4a2b 100644 --- a/fe/src/constants/endpoints.ts +++ b/fe/src/constants/endpoints.ts @@ -22,4 +22,4 @@ export const API_ENDPOINTS = { USER_REGIONS: (memberId: number) => `/members/${memberId}/regions`, CHAT_LIST: (memberId: number) => `/members/${memberId}/chats`, CHAT_ROOM: (chatRoomId: number) => `/chats/${chatRoomId}`, -}; +}; \ No newline at end of file diff --git a/fe/src/constants/path.ts b/fe/src/constants/path.ts index 3427e02c9..d6b709f99 100644 --- a/fe/src/constants/path.ts +++ b/fe/src/constants/path.ts @@ -12,4 +12,4 @@ export const PATH = { CALLBACK: '/callback/:provider', FALLBACK: '*', GOBACK: -1, -}; +}; \ No newline at end of file diff --git a/fe/src/hooks/usePageNavigator.ts b/fe/src/hooks/usePageNavigator.ts index 434c4ec92..c40886d5f 100644 --- a/fe/src/hooks/usePageNavigator.ts +++ b/fe/src/hooks/usePageNavigator.ts @@ -19,4 +19,4 @@ export const usePageNavigator = () => { navigateToGoBack: () => navigate(PATH.GOBACK), navigateToChatRoom: (chatRoomId: number) => navigate(`/chat/${chatRoomId}`), }; -}; +}; \ No newline at end of file diff --git a/fe/src/pages/Product/DetailPage.tsx b/fe/src/pages/Product/DetailPage.tsx index 78900aa5d..c2b22d572 100644 --- a/fe/src/pages/Product/DetailPage.tsx +++ b/fe/src/pages/Product/DetailPage.tsx @@ -210,4 +210,4 @@ const ProductStats = styled.p` width: 100%; font: ${({ theme: { font } }) => font.displayDefault12}; color: ${({ theme: { color } }) => color.neutralTextWeak}; -`; +`; \ No newline at end of file