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

๐Ÿš€ Deploy - S3 Bucket Build #13

Merged
merged 4 commits into from
Aug 19, 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
101 changes: 28 additions & 73 deletions .github/workflows/dev_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,43 @@ name: Web Application Develop Server CI/CD

on:
pull_request:
branches: [ "develop" ]
branches: [ "dev" ]
types:
- opened
- synchronize
- closed

jobs:
CI:
runs-on: ubuntu-20.04
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout
uses: actions/checkout@v3

# Cache Gradle
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

### runner application java ์„ค์ •
- name: Set up JDK 17
uses: actions/setup-java@v3
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
java-version: '17'
distribution: 'temurin'

### gradlew ์‹คํ–‰ ๊ถŒํ•œ ๋ถ€์—ฌ
- name: Grant execute Permission for gradlew
node-version: ${{ matrix.node-version }}
- name: Create env file
run: |
chmod +x gradlew

### project build
- name: Build with Gradle
touch .env
echo REACT_APP_API_ENDPOINT=${{ secrets.AWS_S3_ENDPOINT }} >> .env
cat .env
- name: npm Install
run: |
./gradlew clean build -x test

### Docker Image Build and Push
- name: Login to Docker Hub
if: github.event.pull_request.merged == true
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
if: github.event.pull_request.merged == true
uses: docker/setup-buildx-action@v2

- name: Build and push
if: github.event.pull_request.merged == true
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}

# closed์— ๋Œ€ํ•œ server deploy
CD:
if: github.event.pull_request.merged == true
needs: [CI]

runs-on: ubuntu-20.04

steps:
### SSH Connect and Docker Image Pull and Container Run
- name: Docker Image Pull and Container Run
uses: appleboy/ssh-action@v1.0.0
npm install
- name: npm Build
run: |
npm run build
- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
host: ${{ secrets.DEV_SSH_HOST }}
username: ${{ secrets.DEV_SSH_USERNAME }}
password: ${{ secrets.DEV_SSH_PASSWORD }}
key: ${{ secrets.DEV_SSH_KEY }}
port: ${{ secrets.DEV_SSH_PORT }}
script: |
docker stop was
docker rm was
docker image rm ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}
docker run -d -p 8080:8080 --name was ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}
args: --acl public-read --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_STAGING_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
SOURCE_DIR: "dist"
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
"react-dom": "^18.2.0",
"react-icons": "^5.3.0",
"react-router-dom": "^6.26.1",
"react-speech-recognition": "^3.10.0",
"recoil": "^0.7.7",
"recoil-persist": "^5.1.0",
"regenerator-runtime": "^0.14.1",
"styled-components": "^6.1.12"
},
"devDependencies": {
"@types/node": "^22.4.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-speech-recognition": "^3.9.5",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vitejs/plugin-react": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// App.tsx
import 'regenerator-runtime/runtime'
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { GlobalStyle } from './style/globalStyle';
Expand Down
5 changes: 5 additions & 0 deletions src/assets/icons/DoubleRightChevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/Microphone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions src/components/modal/dialogueDetail/DialogueDetailModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import * as S from "./style";

Check failure on line 1 in src/components/modal/dialogueDetail/DialogueDetailModal.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Cannot find module '@components/common/Badge.tsx' or its corresponding type declarations.
import DoubleRightChevron from "../../../assets/icons/DoubleRightChevron.svg";
import Microphone from "../../../assets/icons/Microphone.svg";
import SizedBox from "@components/common/sized-box/SizedBox.tsx";
import Badge from "@components/common/Badge.tsx";
import {theme} from "../../../style/theme";
import {Spacer} from "@components/common/spacer/style.ts";
import useSpeechToText from "../../../hooks/useSpeechToText.ts";
import {useEffect} from "react";

interface props {
onClick: () => void;
isVisible: boolean;
}

export default function DialogueDetailModal(props: props) {

const { transcript, listening, toggleListening } = useSpeechToText();

const content = "์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›...์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ?";
const adminAnswer = false;

const isAnswered = false;

const isAdmin = true;

const answer = "์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›...์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›...์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›...์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด๊ฐ€์š”? ์ €๋ณด๊ณ  ํ•˜๋ผ๊ณ ์š”? ์–ด์ฉŒ๋ผ๊ณ ์š”? ํ‚น๋ฐ›์ฃ ? ์งˆ๋ฌธ์ด ๋จธ์˜ˆ์š”? ๋จน๋Š”๊ฑด";

useEffect(() => {
console.log(transcript);
}, [transcript]);

return (
<S.Overlay>
<S.Container isVisible={props.isVisible}>
<S.SvgIcon src={DoubleRightChevron} alt="DoubleRightChevron" onClick={props.onClick} width={"32px"} height={"32px"}/>
<SizedBox height={"40px"}/>
<S.Row>
<S.Title>๐Ÿš€ ๋Œ€ํ™” ์ƒ์„ธ</S.Title>
<S.CreatedAt>์ฐธ์—ฌ๋‚ ์งœ: 2021-08-01</S.CreatedAt>
</S.Row>
<SizedBox height={"20px"}/>
<S.Content>
{content}
</S.Content>
<SizedBox height={"40px"}/>
<S.Line/>
<SizedBox height={"40px"}/>
{
!isAdmin && (isAnswered ? (
<>
<S.Row>
<Badge text={adminAnswer ? "๊ด€๋ฆฌ์ž ๋‹ต๋ณ€" : "AI ๋‹ต๋ณ€"} color={adminAnswer ? theme.Colors.primary : theme.Colors.green} textColor={theme.Colors.white}/>
<S.CreatedAt>์ž‘์„ฑ๋‚ ์งœ: 2021-08-01</S.CreatedAt>
</S.Row>
<SizedBox height={"20px"}/>
<S.Content>
{answer}
</S.Content>
</>
) : <>
<S.Empty>์ด์ „์— ์œ ์‚ฌํ•œ ์งˆ๋ฌธ์ด ์—†์—ˆ์–ด์š”... ๊ด€๋ฆฌ์ž๊ฐ€ ๋‹ต๋ณ€์„ ์ž‘์„ฑํ•˜๊ธฐ ์ „์ž…๋‹ˆ๋‹ค...</S.Empty>
</>)
}

{
isAdmin && !isAnswered && (
<>
<S.InputContainer>
<S.Input placeholder={"๋‹ต๋ณ€์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”"}>
{transcript}
</S.Input>
</S.InputContainer>
<SizedBox height={"12px"}/>
<S.ButtonContainer>
<Spacer flex={1} direction={"horizontal"}/>
<S.SvgIcon src={Microphone} alt="Microphone" width={"24px"} height={"24px"} color={listening ? theme.Colors.green600 : theme.Colors.neutral} onClick={toggleListening}/>
<SizedBox width={"12px"}/>
<S.AnswerButton>๋‹ต๋ณ€ํ•˜๊ธฐ</S.AnswerButton>
</S.ButtonContainer>
</>
)
}
</S.Container>
</S.Overlay>
)
}
Loading
Loading