From a899227a4dbdf752972ac3a91771ee00b7f04fcb Mon Sep 17 00:00:00 2001 From: Dustbox <53044223+sanggae4133@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:24:57 +0900 Subject: [PATCH 1/5] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..dd84ea78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 62285fcf2a9ff18711c8e058d6c76c446742924e Mon Sep 17 00:00:00 2001 From: Dustbox <53044223+sanggae4133@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:32:39 +0900 Subject: [PATCH 2/5] Create gradle.yml --- .github/workflows/gradle.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..11acdba9 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,67 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + # with: + # gradle-version: '8.5' + # + # - name: Build with Gradle 8.5 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 From 2736f8ed97e92d1f185d9a78935d96fd81cc070e Mon Sep 17 00:00:00 2001 From: Dustbox <53044223+sanggae4133@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:46:39 +0900 Subject: [PATCH 3/5] Update .gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 11917f68..2a0a6d22 100644 --- a/.gitignore +++ b/.gitignore @@ -253,4 +253,7 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.toptal.com/developers/gitignore/api/intellij,macos,windows,java,linux \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/intellij,macos,windows,java,linux + + +**/application.yml From 03bf6923f0b861cf6610b8c8010bbf2b87be8a68 Mon Sep 17 00:00:00 2001 From: Dustbox <53044223+sanggae4133@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:47:16 +0900 Subject: [PATCH 4/5] Update gradle.yml --- .github/workflows/gradle.yml | 142 ++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 54 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 11acdba9..f9cffaa9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,11 +1,4 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Java CI with Gradle +name: Java CI/DE with Gradle(dev branch) on: push: @@ -13,55 +6,96 @@ on: pull_request: branches: [ "main" ] +permissions: + contents: read + jobs: build: - - runs-on: ubuntu-latest - permissions: - contents: read + name: Build + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 - - - name: Build with Gradle Wrapper - run: ./gradlew build - - # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). - # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. - # - # - name: Setup Gradle - # uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 - # with: - # gradle-version: '8.5' - # - # - name: Build with Gradle 8.5 - # run: gradle build - - dependency-submission: - - runs-on: ubuntu-latest - permissions: - contents: write + # 작업 엑세스 가능하게 $GITHUB_WORKSPACE에서 저장소를 체크아웃 + - name: Checkout branch + uses: actions/checkout@v3 + + # java 버전 세팅 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'zulu' + + # git ignore한 yml 파일들 github secret에서 복사해 오기 + - name: Copy secret + env: + OCCUPY_SECRET: ${{ secrets.OCCUPY_SECRET_DEV }} + OCCUPY_SECRET_DIR: ./src/main/resources + + OCCUPY_SECRET_DIR_FILE_NAME: application-aws.yml + run: | + + touch $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME + + echo "$OCCUPY_SECRET" > $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME + + # gradlew 실행 권한 부여 + - name: Run chmod to make gradlew executable + run: chmod +x ./gradlew + shell: bash + + # Build -> jar 파일 생성 + - name: Build with Gradle + run: ./gradlew clean build -x test + shell: bash + + - name: Upload Build artifacts + uses: actions/upload-artifact@v2 + with: + name: build-artifacts + path: | + build/libs/*.jar + + - name: Upload project code + uses: appleboy/scp-action@master + with: + key: ${{ secrets.EC2_KEY }} + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + target: /home/ubuntu/app/spring_source + source: . + + + deploy: + name: CD with SSH + needs: build + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: build-artifacts + + # JAR 파일을 EC2에 배포하는 step + - name: SCP JAR to EC2 + uses: appleboy/scp-action@master + with: + key: ${{ secrets.EC2_KEY }} + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + source: "*.jar" + target: "/home/ubuntu/app" + + # EC2에 SSH로 배포 커맨드를 입력하는 step + - name: Deploy SSH + uses: appleboy/ssh-action@master + with: + key: ${{ secrets.EC2_KEY }} + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + # 기존 실행 중인 서버 종료 후 jar 파일 실행 + script: | + sudo fuser -k -n tcp 8080 + sleep 15 + sudo nohup java -jar /home/ubuntu/app/*.jar > ./nohup.out 2>&1 & From 22090fdd421a1ba3b3dca9a9bee737690a5e8479 Mon Sep 17 00:00:00 2001 From: Dustbox <53044223+sanggae4133@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:48:23 +0900 Subject: [PATCH 5/5] Create PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..0fa43309 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ +--- +name: UMC-ON BE PR 템플릿 +about: UMC-ON BE PR 템플릿 +title: "PR title" +labels: '' +assignees: '' + +--- + +## #️⃣연관된 이슈 + +> ex) #이슈번호, #이슈번호 + +## 📝작업 내용 + +> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능) + +### 스크린샷 (선택) + +## 💬리뷰 요구사항(선택) + +> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 +> +> ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?