From 03f3bcb6c42d72db1d119af23b78bd21ffcbab9a Mon Sep 17 00:00:00 2001 From: jihyun-j Date: Fri, 14 Jun 2024 15:12:44 +0900 Subject: [PATCH 01/14] =?UTF-8?q?[style]=20global=20style=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/style/globalStyles.ts | 29 ++++++++++++++++++++++++ front/src/theme/themeConfig.ts | 39 ++++++++++++++++++++++++++------- 2 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 front/src/style/globalStyles.ts diff --git a/front/src/style/globalStyles.ts b/front/src/style/globalStyles.ts new file mode 100644 index 00000000..242f51a4 --- /dev/null +++ b/front/src/style/globalStyles.ts @@ -0,0 +1,29 @@ +// Colors +export const globalColors = { + white: "#ffffff", + black: "", + primary: "#2a2f4f", + secondary: "#917fb3", + pink: "#e5beec", + lightPink: "#fde2f3", + scale: { + 50: "#f8f7fb", + 100: "#f2f0f7", + 200: "#e6e4f0", + 300: "#d3cee4", + 400: "#b9b2d3", + 500: "#9f91c1", + 600: "#917fb3", // Secondary + 700: "#7a659c", + 800: "#655582", + 900: "#54476b", + 950: "#362d48", + }, +}; + +// Font Size +export const globalFontSize = { + title: "2.5rem", + subtitle: "2.2rem", + body: "1.8rem", +}; diff --git a/front/src/theme/themeConfig.ts b/front/src/theme/themeConfig.ts index a1a3000e..d3af9c17 100644 --- a/front/src/theme/themeConfig.ts +++ b/front/src/theme/themeConfig.ts @@ -1,18 +1,41 @@ import { createTheme } from "@mui/material/styles"; +import { globalColors } from "../style/globalStyles"; const theme = createTheme({ palette: { primary: { - light: "#FDE2F3", - main: "#917FB3", - dark: "#E5BEEC", - contrastText: "#fff", + light: globalColors.lightPink, + main: globalColors.secondary, + dark: globalColors.pink, + contrastText: globalColors.white, }, secondary: { - light: "#2A2F4F", - main: "#2A2F4F", - dark: "#E5BEEC", - contrastText: "#fff", + light: globalColors.primary, + main: globalColors.primary, + dark: globalColors.pink, + contrastText: globalColors.white, + }, + }, + + components: { + MuiButton: { + styleOverrides: { + contained: { + backgroundColor: globalColors.primary, + color: globalColors.white, + "&:hover": { + backgroundColor: globalColors.secondary, + }, + }, + outlined: { + borderColor: globalColors.primary, + color: globalColors.primary, + "&:hover": { + borderColor: globalColors.secondary, + color: globalColors.secondary, + }, + }, + }, }, }, }); From bba703abedafd47104ede636aec011a477ff3aca Mon Sep 17 00:00:00 2001 From: jihyun-j Date: Fri, 14 Jun 2024 15:23:25 +0900 Subject: [PATCH 02/14] =?UTF-8?q?[feat]=20Chat=EC=82=AC=EC=9D=B4=EB=93=9C?= =?UTF-8?q?=EB=B0=94=EC=97=90=20TextField=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Chat/ChatRoomSideBar.tsx | 57 +++++++++++++------ front/src/components/Map/ServerMap.tsx | 4 +- front/src/store/useChatInputStore.ts | 13 +++++ 3 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 front/src/store/useChatInputStore.ts diff --git a/front/src/components/Chat/ChatRoomSideBar.tsx b/front/src/components/Chat/ChatRoomSideBar.tsx index 20a558b5..eb627116 100644 --- a/front/src/components/Chat/ChatRoomSideBar.tsx +++ b/front/src/components/Chat/ChatRoomSideBar.tsx @@ -1,14 +1,16 @@ -import React, { useCallback } from 'react' -import useChatRoomStore from '../../store/useChatRoomStore' -import { Box, styled } from '@mui/material'; +import React, { useCallback, useRef } from "react"; +import useChatRoomStore from "../../store/useChatRoomStore"; +import { Box, TextField, styled } from "@mui/material"; import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; +import useChatInputStore from "../../store/useChatInputStore"; const ChatRoomSideBar = () => { - const setIsChatRoomShow = useChatRoomStore((state)=> state.setIsChatRoomShow); - const handleChatRoomClose = useCallback(()=>{ + const setIsChatRoomShow = useChatRoomStore( + (state) => state.setIsChatRoomShow + ); + const handleChatRoomClose = useCallback(() => { setIsChatRoomShow(false); - },[setIsChatRoomShow]) - + }, [setIsChatRoomShow]); const DrawerHeader = styled("div")(({ theme }) => ({ display: "flex", @@ -19,18 +21,41 @@ const ChatRoomSideBar = () => { justifyContent: "flex-start", })); + // Chat Input + const chatInputRef = useRef(null); + const setChatInputValue = useChatInputStore((state) => state.setInputValue); + + const handleClearTextField = (e: React.KeyboardEvent) => { + if (chatInputRef.current && e.key === "Enter") { + chatInputRef.current.value = ""; + } + }; + + const handleChatInputChange = useCallback( + (e: React.ChangeEvent) => { + setChatInputValue(e.target.value); + }, + [setChatInputValue] + ); + return ( - - + -
다이렉트 메세지
+
다이렉트 메세지
+
- ) -} + ); +}; -export default ChatRoomSideBar \ No newline at end of file +export default ChatRoomSideBar; diff --git a/front/src/components/Map/ServerMap.tsx b/front/src/components/Map/ServerMap.tsx index 3a2c8c3f..967dd1e6 100644 --- a/front/src/components/Map/ServerMap.tsx +++ b/front/src/components/Map/ServerMap.tsx @@ -5,7 +5,6 @@ import EnterServer from "./main"; import { MainMap } from "./ServerMap/MainMap"; import VideoCallBoxList from "../VideoCall/VideoCallBoxList"; - // 서버를 생성하고 관리하는 컴포넌트 // forwardRef를 사용해 부모 컴포넌트로부터 ref를 전달 받음 export const ServerMap = forwardRef( @@ -124,8 +123,7 @@ export const ServerMap = forwardRef(
드래그
- - + ); diff --git a/front/src/store/useChatInputStore.ts b/front/src/store/useChatInputStore.ts new file mode 100644 index 00000000..cbf1d494 --- /dev/null +++ b/front/src/store/useChatInputStore.ts @@ -0,0 +1,13 @@ +import create from "zustand"; + +interface ChatInputState { + inputValue: string; + setInputValue: (value: string) => void; +} + +const useChatInputStore = create((set) => ({ + inputValue: "", + setInputValue: (value) => set({ inputValue: value }), +})); + +export default useChatInputStore; From 93987e98fc2a8e56f692ba7233ce6464d49f8fcb Mon Sep 17 00:00:00 2001 From: jihyun-j Date: Sat, 15 Jun 2024 15:53:10 +0900 Subject: [PATCH 03/14] =?UTF-8?q?[feat]=20ChatInput=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Chat/ChatInputField.tsx | 30 ++++++++++++++++ front/src/components/Chat/ChatRoomSideBar.tsx | 31 +++-------------- front/src/components/Layout/Header.tsx | 4 +-- front/src/components/Map/ServerMap.tsx | 34 ++++++------------- front/src/components/Map/ServerMap/MainMap.ts | 1 + 5 files changed, 48 insertions(+), 52 deletions(-) create mode 100644 front/src/components/Chat/ChatInputField.tsx diff --git a/front/src/components/Chat/ChatInputField.tsx b/front/src/components/Chat/ChatInputField.tsx new file mode 100644 index 00000000..189e768b --- /dev/null +++ b/front/src/components/Chat/ChatInputField.tsx @@ -0,0 +1,30 @@ +import { Button, ButtonGroup, TextField } from "@mui/material"; +import useChatInputStore from "../../store/useChatInputStore"; +import { Send } from "@mui/icons-material"; + +const ChatInputField = () => { + const chatInputValue = useChatInputStore((state) => state.inputValue); + const setChatInputValue = useChatInputStore((state) => state.setInputValue); + + const handleSendMessage = (e: React.FormEvent) => { + e.preventDefault(); + if (chatInputValue.trim() !== "") { + setChatInputValue(chatInputValue); + setChatInputValue(""); + } + }; + + return ( +
+ setChatInputValue(e.target.value)} + /> + + + + ); +}; + +export default ChatInputField; diff --git a/front/src/components/Chat/ChatRoomSideBar.tsx b/front/src/components/Chat/ChatRoomSideBar.tsx index eb627116..89d02ce6 100644 --- a/front/src/components/Chat/ChatRoomSideBar.tsx +++ b/front/src/components/Chat/ChatRoomSideBar.tsx @@ -1,8 +1,9 @@ -import React, { useCallback, useRef } from "react"; +import { useCallback } from "react"; import useChatRoomStore from "../../store/useChatRoomStore"; -import { Box, TextField, styled } from "@mui/material"; +import { Box, styled } from "@mui/material"; import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; -import useChatInputStore from "../../store/useChatInputStore"; + +import ChatInputField from "./ChatInputField"; const ChatRoomSideBar = () => { const setIsChatRoomShow = useChatRoomStore( @@ -21,23 +22,6 @@ const ChatRoomSideBar = () => { justifyContent: "flex-start", })); - // Chat Input - const chatInputRef = useRef(null); - const setChatInputValue = useChatInputStore((state) => state.setInputValue); - - const handleClearTextField = (e: React.KeyboardEvent) => { - if (chatInputRef.current && e.key === "Enter") { - chatInputRef.current.value = ""; - } - }; - - const handleChatInputChange = useCallback( - (e: React.ChangeEvent) => { - setChatInputValue(e.target.value); - }, - [setChatInputValue] - ); - return ( { />
다이렉트 메세지
- +
); diff --git a/front/src/components/Layout/Header.tsx b/front/src/components/Layout/Header.tsx index 7d104c98..ccd1bbfd 100644 --- a/front/src/components/Layout/Header.tsx +++ b/front/src/components/Layout/Header.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import MuiAppBar from "@mui/material/AppBar"; -import { Box, Drawer, Toolbar, Typography, styled } from "@mui/material"; +import { Box, Drawer, Input, Toolbar, Typography, styled } from "@mui/material"; import SupervisedUserCircleIcon from "@mui/icons-material/SupervisedUserCircle"; import ChatBubbleIcon from "@mui/icons-material/ChatBubble"; import FriendsRightSideBar from "./FriendsRightSideBar"; @@ -106,4 +106,4 @@ const Header = () => { ); }; -export default Header; \ No newline at end of file +export default Header; diff --git a/front/src/components/Map/ServerMap.tsx b/front/src/components/Map/ServerMap.tsx index 967dd1e6..7165baf4 100644 --- a/front/src/components/Map/ServerMap.tsx +++ b/front/src/components/Map/ServerMap.tsx @@ -2,8 +2,8 @@ import { forwardRef, useEffect, useLayoutEffect, useRef } from "react"; import { EventBus } from "./EventBus"; import { ServerMapProps, ServerMapTypes } from "../../types/map"; import EnterServer from "./main"; -import { MainMap } from "./ServerMap/MainMap"; import VideoCallBoxList from "../VideoCall/VideoCallBoxList"; +import useChatInputStore from "../../store/useChatInputStore"; // 서버를 생성하고 관리하는 컴포넌트 // forwardRef를 사용해 부모 컴포넌트로부터 ref를 전달 받음 @@ -11,6 +11,7 @@ export const ServerMap = forwardRef( function ServerMap({ currentActiveScene }, ref) { // Phaser.Game 인스턴스를 저장하기 위한 ref 생성 const mapRef = useRef(null!); + const chatInputValue = useChatInputStore((state) => state.inputValue); // 브라우저 화면 크기에 따라서 맵의 크기도 리사이즈 되는 함수 const resizeMap = () => { @@ -39,7 +40,7 @@ export const ServerMap = forwardRef( resizeMap(); window.addEventListener("resize", resizeMap, false); - // 확대 & 축소 이벤트 + // 화면 확대 document.getElementById("zoom-in")?.addEventListener("click", () => { if (mapRef.current) { const mainCamera = mapRef.current.scene.scenes[1].cameras.main; @@ -49,6 +50,7 @@ export const ServerMap = forwardRef( } }); + // 화면 축소 document.getElementById("zoom-out")?.addEventListener("click", () => { if (mapRef.current) { const mainCamera = mapRef.current.scene.scenes[1].cameras.main; @@ -89,29 +91,14 @@ export const ServerMap = forwardRef( }; }, [currentActiveScene, ref]); - useEffect(() => { - const inputField = document.getElementById( - "chat-input" - ) as HTMLInputElement; - console.log(inputField); - const handleKeyEnter = (event: KeyboardEvent) => { - if (event.key === "Enter") { - const target = event.target as HTMLInputElement; - - const mainScene = mapRef.current?.scene.getScene( - "MainMap" - ) as MainMap; - mainScene?.setBalloonText(target.value); - } - }; - inputField?.addEventListener("keydown", handleKeyEnter); - return () => { - inputField?.removeEventListener("keydown", handleKeyEnter); - }; - }, []); + useEffect(() => {}, []); return ( -
+
+
+ +
+
@@ -123,7 +110,6 @@ export const ServerMap = forwardRef(
드래그
-
); diff --git a/front/src/components/Map/ServerMap/MainMap.ts b/front/src/components/Map/ServerMap/MainMap.ts index eabfcf6e..1a4c1ab4 100644 --- a/front/src/components/Map/ServerMap/MainMap.ts +++ b/front/src/components/Map/ServerMap/MainMap.ts @@ -100,6 +100,7 @@ export class MainMap extends Scene { } this.speechBalloon.setPosition(this.character.x, this.character.y - 50); } + setBalloonText(text: string) { if (this.speechBalloon) { this.speechBalloon.setText(text); From 7eb7a7f31b933bec81b4ba1cb346aeb56b691a08 Mon Sep 17 00:00:00 2001 From: jihyun-j Date: Sat, 15 Jun 2024 19:33:59 +0900 Subject: [PATCH 04/14] =?UTF-8?q?[fix]=20Text=20Input=20=EB=9D=84=EC=96=B4?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Chat/ChatInputField.tsx | 9 +++++++- front/src/components/Map/ServerMap/MainMap.ts | 22 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/front/src/components/Chat/ChatInputField.tsx b/front/src/components/Chat/ChatInputField.tsx index 189e768b..0b615125 100644 --- a/front/src/components/Chat/ChatInputField.tsx +++ b/front/src/components/Chat/ChatInputField.tsx @@ -1,4 +1,4 @@ -import { Button, ButtonGroup, TextField } from "@mui/material"; +import { TextField } from "@mui/material"; import useChatInputStore from "../../store/useChatInputStore"; import { Send } from "@mui/icons-material"; @@ -10,6 +10,12 @@ const ChatInputField = () => { e.preventDefault(); if (chatInputValue.trim() !== "") { setChatInputValue(chatInputValue); + + const event = new CustomEvent("updateBalloonText", { + detail: chatInputValue, + }); + window.dispatchEvent(event); + setChatInputValue(""); } }; @@ -20,6 +26,7 @@ const ChatInputField = () => { type="text" value={chatInputValue} onChange={(e) => setChatInputValue(e.target.value)} + sx={{ wordBreak: "break" }} /> diff --git a/front/src/components/Map/ServerMap/MainMap.ts b/front/src/components/Map/ServerMap/MainMap.ts index 1a4c1ab4..93b2d19a 100644 --- a/front/src/components/Map/ServerMap/MainMap.ts +++ b/front/src/components/Map/ServerMap/MainMap.ts @@ -7,9 +7,6 @@ export class MainMap extends Scene { private mapInstance!: Phaser.Game; private character!: Phaser.Physics.Arcade.Sprite; private keyboards!: Phaser.Types.Input.Keyboard.CursorKeys; - private isDragging: boolean = false; - private dragStartX: number = 0; - private dragStartY: number = 0; private speechBalloon!: Phaser.GameObjects.Text; constructor() { @@ -60,6 +57,11 @@ export class MainMap extends Scene { resolution: 2, }) .setOrigin(0.5); + + window.addEventListener("updateBalloonText", (event: Event) => { + const customEvent = event as CustomEvent; + this.setBalloonText(customEvent.detail); + }); } catch (error) { console.error(error); } @@ -83,6 +85,20 @@ export class MainMap extends Scene { this.character.setVelocity(0); + this.input.keyboard?.on("keydown", (e: KeyboardEvent) => { + if (document.activeElement?.tagName === "INPUT") { + this.input.keyboard?.removeCapture( + Phaser.Input.Keyboard.KeyCodes.SPACE + ); + this.input.keyboard?.removeCapture(Phaser.Input.Keyboard.KeyCodes.UP); + this.input.keyboard?.removeCapture(Phaser.Input.Keyboard.KeyCodes.DOWN); + this.input.keyboard?.removeCapture(Phaser.Input.Keyboard.KeyCodes.LEFT); + this.input.keyboard?.removeCapture( + Phaser.Input.Keyboard.KeyCodes.RIGHT + ); + } + }); + if (this.keyboards.down.isDown) { this.character.setVelocityY(100); this.character.anims.play("basic_character_move_down", true); From 7d3e84491142a70bc9fba84b745c5b4d729bef36 Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 11:29:25 +0900 Subject: [PATCH 05/14] =?UTF-8?q?chore=20:=20github=20actions=20ci=20job?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..3b07a606 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: [ dev ] # push 되었을 때, 실행 + +jobs: + cd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # jdk 21 환경 구성 + - name: set up jdk 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + + # Gradle wrapper 파일 실행 권한주기 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + # Gradle test를 실행한다 + - name: update image using jib + run: ./gradlew --info jib From 2aa1d55172718aacb5917a43d8bbe466d2349a68 Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 11:31:33 +0900 Subject: [PATCH 06/14] =?UTF-8?q?chore=20:=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EC=B6=94=EC=A0=81=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20tag=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/build.gradle.kts | 2 +- server/build.gradle.kts | 2 +- user/build.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts index 00d62a3a..4b007340 100644 --- a/auth/build.gradle.kts +++ b/auth/build.gradle.kts @@ -94,7 +94,7 @@ jib { to { image = "youdong98/kpring-auth-application" setAllowInsecureRegistries(true) - tags = setOf("latest") + tags = setOf("latest", System.nanoTime().toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 04969f8c..e5393b57 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -91,7 +91,7 @@ jib { to { image = "youdong98/kpring-server-application" setAllowInsecureRegistries(true) - tags = setOf("latest") + tags = setOf("latest", System.nanoTime().toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") diff --git a/user/build.gradle.kts b/user/build.gradle.kts index 4b861640..70d29a9f 100644 --- a/user/build.gradle.kts +++ b/user/build.gradle.kts @@ -75,7 +75,7 @@ jib { to { image = "youdong98/kpring-user-application" setAllowInsecureRegistries(true) - tags = setOf("latest") + tags = setOf("latest", System.nanoTime().toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") From eaebb816a78e497195d5fcc6acdfda34f235841a Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 14:58:48 +0900 Subject: [PATCH 07/14] =?UTF-8?q?chore:=20git=20commit=20hash=EB=A5=BC=20?= =?UTF-8?q?=ED=86=B5=ED=95=9C=20=EB=B2=84=EC=A0=84=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/build.gradle.kts | 2 +- build.gradle.kts | 25 ++++++++++++++++++- server/build.gradle.kts | 2 +- .../kotlin/kpring/server/util/DtoMapper.kt | 2 +- user/build.gradle.kts | 2 +- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts index 4b007340..d1da7fcd 100644 --- a/auth/build.gradle.kts +++ b/auth/build.gradle.kts @@ -94,7 +94,7 @@ jib { to { image = "youdong98/kpring-auth-application" setAllowInsecureRegistries(true) - tags = setOf("latest", System.nanoTime().toString()) + tags = setOf("latest", version.toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") diff --git a/build.gradle.kts b/build.gradle.kts index c700c98d..1fabda5d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.springframework.boot.gradle.tasks.bundling.BootJar +import java.io.IOException plugins { id("org.springframework.boot") version "3.2.4" @@ -17,7 +18,7 @@ repositories { allprojects { group = "com.sideproject" - version = "0.0.1-SNAPSHOT" + version = "git rev-parse --short=8 HEAD".runCommand(workingDir = rootDir) repositories { mavenCentral() @@ -53,3 +54,25 @@ subprojects { debug.set(true) } } + +/** + * cli 실행 결과를 반환한기 위한 함수 + */ +fun String.runCommand( + workingDir: File = File("."), + timeoutAmount: Long = 60, + timeoutUnit: TimeUnit = TimeUnit.SECONDS, +): String = + ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex())) + .directory(workingDir) + .redirectOutput(ProcessBuilder.Redirect.PIPE) + .redirectError(ProcessBuilder.Redirect.PIPE) + .start() + .apply { waitFor(timeoutAmount, timeoutUnit) } + .run { + val error = errorStream.bufferedReader().readText().trim() + if (error.isNotEmpty()) { + throw IOException(error) + } + inputStream.bufferedReader().readText().trim() + } diff --git a/server/build.gradle.kts b/server/build.gradle.kts index e5393b57..8cc6886f 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -91,7 +91,7 @@ jib { to { image = "youdong98/kpring-server-application" setAllowInsecureRegistries(true) - tags = setOf("latest", System.nanoTime().toString()) + tags = setOf("latest", version.toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") diff --git a/server/src/main/kotlin/kpring/server/util/DtoMapper.kt b/server/src/main/kotlin/kpring/server/util/DtoMapper.kt index 244192cf..ef37b0ea 100644 --- a/server/src/main/kotlin/kpring/server/util/DtoMapper.kt +++ b/server/src/main/kotlin/kpring/server/util/DtoMapper.kt @@ -5,7 +5,7 @@ import kpring.core.server.dto.ServerThemeInfo import kpring.server.domain.Category import kpring.server.domain.Theme -fun Category.toInfo(): CategoryInfo { +fun Category.toInfo(): CategoryInfo { return CategoryInfo( id = this.name, name = this.toString(), diff --git a/user/build.gradle.kts b/user/build.gradle.kts index 70d29a9f..97628071 100644 --- a/user/build.gradle.kts +++ b/user/build.gradle.kts @@ -75,7 +75,7 @@ jib { to { image = "youdong98/kpring-user-application" setAllowInsecureRegistries(true) - tags = setOf("latest", System.nanoTime().toString()) + tags = setOf("latest", version.toString()) } container { jvmFlags = listOf("-Xms512m", "-Xmx512m") From 4eb830c457def6b256fd114d75d45b2d23e3596f Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 15:01:59 +0900 Subject: [PATCH 08/14] =?UTF-8?q?chore=20:=20ip=20->=20hostname=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/build.gradle.kts | 2 +- infra/compose.yml | 2 +- server/build.gradle.kts | 2 +- user/build.gradle.kts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts index d1da7fcd..93c5f609 100644 --- a/auth/build.gradle.kts +++ b/auth/build.gradle.kts @@ -70,7 +70,7 @@ tasks.asciidoctor { dependsOn(tasks.test) } -val hostname = "152.70.145.249" +val hostname = "kpring.duckdns.org" openapi3 { setServer("http://$hostname/auth") diff --git a/infra/compose.yml b/infra/compose.yml index f04d004c..623d1962 100644 --- a/infra/compose.yml +++ b/infra/compose.yml @@ -10,4 +10,4 @@ services: ports: - "8080:8080" environment: - URLS: "[{name: 'auth', url: 'http://152.70.145.249/auth/static/openapi3.yaml'},{name: 'user', url: 'http://152.70.145.249/user/static/openapi3.yaml'}, {name: 'server', url: 'http://152.70.145.249/server/static/openapi3.yaml'}]" + URLS: "[{name: 'auth', url: 'http://kpring.duckdns.org/auth/static/openapi3.yaml'},{name: 'user', url: 'http://kpring.duckdns.org/user/static/openapi3.yaml'}, {name: 'server', url: 'http://kpring.duckdns.org/server/static/openapi3.yaml'}]" diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 8cc6886f..c2fd02cc 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -67,7 +67,7 @@ kapt { annotationProcessor("org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor") } -val hostname = "152.70.145.249" +val hostname = "kpring.duckdns.org" openapi3 { setServer("http://$hostname/server") diff --git a/user/build.gradle.kts b/user/build.gradle.kts index 97628071..3c49ed7d 100644 --- a/user/build.gradle.kts +++ b/user/build.gradle.kts @@ -51,7 +51,7 @@ dependencies { implementation("org.springframework.restdocs:spring-restdocs-asciidoctor") } -val hostname = "152.70.145.249" +val hostname = "kpring.duckdns.org" openapi3 { setServer("http://$hostname/user") From 68382ffe02e2d8bd111fab138a22026ffa362567 Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 15:04:16 +0900 Subject: [PATCH 09/14] =?UTF-8?q?chore=20:=20main=20push=EC=8B=9C=EC=97=90?= =?UTF-8?q?=20ci=20=EC=9E=91=EC=97=85=EC=9D=B4=20=EC=9E=91=EB=8F=99?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b07a606..54c1987c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ dev ] # push 되었을 때, 실행 + branches: [ main ] # push 되었을 때, 실행 jobs: cd: From 3627418b86746432ae51918ab3fbbaf2f629e73e Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 16:14:17 +0900 Subject: [PATCH 10/14] =?UTF-8?q?docs=20:=20=EC=A3=BC=EC=84=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54c1987c..3a175800 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,6 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - # Gradle test를 실행한다 + # Gradle jib를 통한 이미지 배포 - name: update image using jib run: ./gradlew --info jib From 04fdd32f5e07092150cc00b4ae40add5ac375c04 Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 16:32:10 +0900 Subject: [PATCH 11/14] =?UTF-8?q?chore=20:=20dockerhub=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a175800..a7638183 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,12 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + # Gradle jib를 통한 이미지 배포 - name: update image using jib run: ./gradlew --info jib From 5d5c3ce5ee8c57cb91a7b485388978fcc09f6187 Mon Sep 17 00:00:00 2001 From: minahYu Date: Tue, 18 Jun 2024 19:01:04 +0900 Subject: [PATCH 12/14] =?UTF-8?q?fix:=20getFriendRequests=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=EB=90=9C=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/kpring/user/service/FriendServiceImpl.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/user/src/main/kotlin/kpring/user/service/FriendServiceImpl.kt b/user/src/main/kotlin/kpring/user/service/FriendServiceImpl.kt index d1d7e16a..db4db159 100644 --- a/user/src/main/kotlin/kpring/user/service/FriendServiceImpl.kt +++ b/user/src/main/kotlin/kpring/user/service/FriendServiceImpl.kt @@ -20,12 +20,12 @@ class FriendServiceImpl( override fun getFriendRequests(userId: Long): GetFriendRequestsResponse { val friendRelations: List = friendRepository.findAllByUserIdAndRequestStatus(userId, FriendRequestStatus.RECEIVED) - val friendRequests: MutableList = mutableListOf() - friendRelations.stream().map { friendRelation -> - val friend = friendRelation.friend - GetFriendRequestResponse(friend.id!!, friend.username) - }.collect(Collectors.toList()) + val friendRequests = + friendRelations.stream().map { friendRelation -> + val friend = friendRelation.friend + GetFriendRequestResponse(friend.id!!, friend.username) + }.collect(Collectors.toList()) return GetFriendRequestsResponse(userId, friendRequests) } From 7a1914e044dd0bf9e978d77e25ebb55bc73ea90c Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 21:04:26 +0900 Subject: [PATCH 13/14] =?UTF-8?q?chore=20:=20image=20tag=20update=20action?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7638183..b6a54905 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: [ main ] # push 되었을 때, 실행 jobs: - cd: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -30,3 +30,37 @@ jobs: # Gradle jib를 통한 이미지 배포 - name: update image using jib run: ./gradlew --info jib + + tagging: + needs: + - build + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: set tag + run: | + echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV + + - name: checkout infra repository + uses: actions/checkout@v4 + with: + repository: kSideProject/kpring-infra + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + ref: main + + - name: edit infra repository tag + run: | + echo 'env(IMAGE_TAG)' + yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/server/values.yaml + yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/user/values.yaml + yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/auth/values.yaml + + - name: commit + uses: leigholiver/commit-with-deploy-key@v1.0.4 + with: + source: . + destination_repo: kSideProject/kpring-infra + deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} + commit_message: 'ci: update tag to env(IMAGE_TAG)'' From 341997691c110f69e3b3141d9c968475ff3de7a5 Mon Sep 17 00:00:00 2001 From: yudonggeun Date: Tue, 18 Jun 2024 21:18:03 +0900 Subject: [PATCH 14/14] chore : fix bug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6a54905..ad670b25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,4 +63,4 @@ jobs: source: . destination_repo: kSideProject/kpring-infra deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} - commit_message: 'ci: update tag to env(IMAGE_TAG)'' + commit_message: 'ci: update tag to env(IMAGE_TAG)'