From 9ed4b34209a1d238ee466917b140cfe37b1a82af Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:36:46 +0900 Subject: [PATCH 01/18] Update and rename prod-1-cicd.yml to prod-eureka-cicd.yml --- .github/workflows/{prod-1-cicd.yml => prod-eureka-cicd.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{prod-1-cicd.yml => prod-eureka-cicd.yml} (97%) diff --git a/.github/workflows/prod-1-cicd.yml b/.github/workflows/prod-eureka-cicd.yml similarity index 97% rename from .github/workflows/prod-1-cicd.yml rename to .github/workflows/prod-eureka-cicd.yml index 21d1676..722ba15 100644 --- a/.github/workflows/prod-1-cicd.yml +++ b/.github/workflows/prod-eureka-cicd.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "prod-1" ] + branches: [ "prod-eureka" ] pull_request: - branches: [ "prod-1" ] + branches: [ "prod-eureka" ] jobs: build: From f281190564372a65f8721baf6c7d0e459fa6cd2b Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:37:10 +0900 Subject: [PATCH 02/18] Update and rename prod-2-cicd.yml to prod-contents-cicd.yml --- .github/workflows/{prod-2-cicd.yml => prod-contents-cicd.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{prod-2-cicd.yml => prod-contents-cicd.yml} (98%) diff --git a/.github/workflows/prod-2-cicd.yml b/.github/workflows/prod-contents-cicd.yml similarity index 98% rename from .github/workflows/prod-2-cicd.yml rename to .github/workflows/prod-contents-cicd.yml index 1058c13..8d280ce 100644 --- a/.github/workflows/prod-2-cicd.yml +++ b/.github/workflows/prod-contents-cicd.yml @@ -9,7 +9,7 @@ name: Java CI with Gradle on: push: - branches: [ "prod-2" ] + branches: [ "prod-" ] pull_request: branches: [ "prod-2" ] From 084761383aafb9f1286ff0f52af1bc27d1c596e4 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:37:22 +0900 Subject: [PATCH 03/18] Update prod-contents-cicd.yml --- .github/workflows/prod-contents-cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prod-contents-cicd.yml b/.github/workflows/prod-contents-cicd.yml index 8d280ce..6202c4e 100644 --- a/.github/workflows/prod-contents-cicd.yml +++ b/.github/workflows/prod-contents-cicd.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "prod-" ] + branches: [ "prod-contents" ] pull_request: - branches: [ "prod-2" ] + branches: [ "prod-contents" ] jobs: build: From 2ffae7aec1f35a07daea7d3b6b37c3a15e94d832 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:37:39 +0900 Subject: [PATCH 04/18] Update and rename prod-3-cicd.yml to prod-apigateway-cicd.yml --- .../workflows/{prod-3-cicd.yml => prod-apigateway-cicd.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{prod-3-cicd.yml => prod-apigateway-cicd.yml} (96%) diff --git a/.github/workflows/prod-3-cicd.yml b/.github/workflows/prod-apigateway-cicd.yml similarity index 96% rename from .github/workflows/prod-3-cicd.yml rename to .github/workflows/prod-apigateway-cicd.yml index 21d1676..c024465 100644 --- a/.github/workflows/prod-3-cicd.yml +++ b/.github/workflows/prod-apigateway-cicd.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "prod-1" ] + branches: [ "prod-apigateway" ] pull_request: - branches: [ "prod-1" ] + branches: [ "prod-apigateway" ] jobs: build: From b7055fa561e224cd698f87a73dac5798c1f07c57 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:38:33 +0900 Subject: [PATCH 05/18] Create prod-keyword-cicd.yml --- .github/workflows/prod-keyword-cicd.yml | 67 +++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/prod-keyword-cicd.yml diff --git a/.github/workflows/prod-keyword-cicd.yml b/.github/workflows/prod-keyword-cicd.yml new file mode 100644 index 0000000..f753839 --- /dev/null +++ b/.github/workflows/prod-keyword-cicd.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: [ "prod-keyword" ] + pull_request: + branches: [ "prod-keyword" ] + +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 GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 From be77932fd73bcb3d39d73d4a15ca3ee1c2a3860a Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:39:09 +0900 Subject: [PATCH 06/18] Rename prod-keyword-cicd.yml to prod-keyword-deploy.yml --- .../workflows/{prod-keyword-cicd.yml => prod-keyword-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{prod-keyword-cicd.yml => prod-keyword-deploy.yml} (100%) diff --git a/.github/workflows/prod-keyword-cicd.yml b/.github/workflows/prod-keyword-deploy.yml similarity index 100% rename from .github/workflows/prod-keyword-cicd.yml rename to .github/workflows/prod-keyword-deploy.yml From 3066e2f69529ec4d77b26058cd004a2d721a1576 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:39:22 +0900 Subject: [PATCH 07/18] Rename prod-eureka-cicd.yml to prod-eureka-deploy.yml --- .../workflows/{prod-eureka-cicd.yml => prod-eureka-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{prod-eureka-cicd.yml => prod-eureka-deploy.yml} (100%) diff --git a/.github/workflows/prod-eureka-cicd.yml b/.github/workflows/prod-eureka-deploy.yml similarity index 100% rename from .github/workflows/prod-eureka-cicd.yml rename to .github/workflows/prod-eureka-deploy.yml From d999f3c3407c487a8c44d20ef6f6ea2dda68a3eb Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:39:35 +0900 Subject: [PATCH 08/18] Rename prod-contents-cicd.yml to prod-contents-deploy.yml --- .../{prod-contents-cicd.yml => prod-contents-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{prod-contents-cicd.yml => prod-contents-deploy.yml} (100%) diff --git a/.github/workflows/prod-contents-cicd.yml b/.github/workflows/prod-contents-deploy.yml similarity index 100% rename from .github/workflows/prod-contents-cicd.yml rename to .github/workflows/prod-contents-deploy.yml From 9138bfc2d378b7b94187aec35e0faafb0b335645 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:39:48 +0900 Subject: [PATCH 09/18] Rename prod-apigateway-cicd.yml to prod-apigateway-deploy.yml --- .../{prod-apigateway-cicd.yml => prod-apigateway-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{prod-apigateway-cicd.yml => prod-apigateway-deploy.yml} (100%) diff --git a/.github/workflows/prod-apigateway-cicd.yml b/.github/workflows/prod-apigateway-deploy.yml similarity index 100% rename from .github/workflows/prod-apigateway-cicd.yml rename to .github/workflows/prod-apigateway-deploy.yml From 1f3e801bcd51bd09b3bff5303b92635d8d8c9f26 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:40:29 +0900 Subject: [PATCH 10/18] Create prod-member-deploy.yml --- .github/workflows/prod-member-deploy.yml | 67 ++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/prod-member-deploy.yml diff --git a/.github/workflows/prod-member-deploy.yml b/.github/workflows/prod-member-deploy.yml new file mode 100644 index 0000000..f753839 --- /dev/null +++ b/.github/workflows/prod-member-deploy.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: [ "prod-keyword" ] + pull_request: + branches: [ "prod-keyword" ] + +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 GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 From 5f11b613ce3ca6d4302cd0e1f718c788b4df6bc7 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:41:05 +0900 Subject: [PATCH 11/18] Create prod-community-deploy.yml --- .github/workflows/prod-community-deploy.yml | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/prod-community-deploy.yml diff --git a/.github/workflows/prod-community-deploy.yml b/.github/workflows/prod-community-deploy.yml new file mode 100644 index 0000000..09ee511 --- /dev/null +++ b/.github/workflows/prod-community-deploy.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: [ "prod-community" ] + pull_request: + branches: [ "prod-community" ] + +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 GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 From d8ca389800f5d4cfe2926b817377521972bd2ccc Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:41:25 +0900 Subject: [PATCH 12/18] Update prod-member-deploy.yml --- .github/workflows/prod-member-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prod-member-deploy.yml b/.github/workflows/prod-member-deploy.yml index f753839..9dad386 100644 --- a/.github/workflows/prod-member-deploy.yml +++ b/.github/workflows/prod-member-deploy.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "prod-keyword" ] + branches: [ "prod-member" ] pull_request: - branches: [ "prod-keyword" ] + branches: [ "prod-member" ] jobs: build: From 448a7ea09105470bfec1ac56798e3fd9953eeb80 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:02:06 +0900 Subject: [PATCH 13/18] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..32cbeb3 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +광장 리팩토링✨💗 From 9313b7992cc3c75c086c18e8c214530765052c67 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:02:20 +0900 Subject: [PATCH 14/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32cbeb3..d097c10 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -광장 리팩토링✨💗 +## 광장 리팩토링✨💗 From 4e45b0d3a59546b98a822f4fea45d94093dbd771 Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:11:17 +0900 Subject: [PATCH 15/18] Update prod-contents-deploy.yml --- .github/workflows/prod-contents-deploy.yml | 90 +++++++++++----------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/.github/workflows/prod-contents-deploy.yml b/.github/workflows/prod-contents-deploy.yml index 6202c4e..1e2b424 100644 --- a/.github/workflows/prod-contents-deploy.yml +++ b/.github/workflows/prod-contents-deploy.yml @@ -14,54 +14,56 @@ on: branches: [ "prod-contents" ] jobs: - build: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' - runs-on: ubuntu-latest - permissions: - contents: read + - name: Clean Gradle Cache + run: ./gradlew clean - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' + - name: Make application.yml + run: | + mkdir -p src/main/resources + echo "$APPLICATION" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_CONTENTS }} - # Configure Gradle for optimal use in GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + - name: Grant execute permission for gradlew + run: chmod +x gradlew - - name: Build with Gradle Wrapper - run: ./gradlew build + - name: Build with Gradle + run: ./gradlew build -x test - # 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 - # with: - # gradle-version: '8.5' - # - # - name: Build with Gradle 8.5 - # run: gradle build + - name: Docker build + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/contents:latest + docker push ${{ secrets.DOCKER_USERNAME }}/contents:latest - dependency-submission: + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST_CONTENTS }} + key: ${{ secrets.PRIVATE_KEY_CONTENTS }} + port: ${{ secrets.PORT }} + source: "./docker-compose-contents.yml" + target: "/home/ec2-user/" - 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_CONTENTS }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_CONTENTS }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/contents:latest + docker image prune -a -f + docker-compose up -dons/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 From 2951056ca540d39acc052e4061ca10d16de1216c Mon Sep 17 00:00:00 2001 From: eojinny <96863137+eojinny@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:15:47 +0900 Subject: [PATCH 16/18] Update prod-contents-deploy.yml --- .github/workflows/prod-contents-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prod-contents-deploy.yml b/.github/workflows/prod-contents-deploy.yml index 1e2b424..90040b0 100644 --- a/.github/workflows/prod-contents-deploy.yml +++ b/.github/workflows/prod-contents-deploy.yml @@ -51,7 +51,7 @@ jobs: uses: appleboy/scp-action@master with: username: ec2-user - host: ${{ secrets.HOST_CONTENTS }} + host: ${{ secrets.HOST_PROD_2 }} key: ${{ secrets.PRIVATE_KEY_CONTENTS }} port: ${{ secrets.PORT }} source: "./docker-compose-contents.yml" From c0b2e484cbb1d53fec334e4121df075000934fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=20=EC=8A=B9=20=EC=97=B0?= <53565255+seungyeonn-i@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:21:38 +0900 Subject: [PATCH 17/18] Update prod-member-deploy.yml --- .github/workflows/prod-member-deploy.yml | 93 ++++++++++++------------ 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/.github/workflows/prod-member-deploy.yml b/.github/workflows/prod-member-deploy.yml index 9dad386..2ccc6ed 100644 --- a/.github/workflows/prod-member-deploy.yml +++ b/.github/workflows/prod-member-deploy.yml @@ -5,7 +5,7 @@ # 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: MemberService on: push: @@ -21,47 +21,50 @@ jobs: 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 GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make application.yml + run: | + mkdir -p src/main/resources + echo "$APPLICATION_MEMBER" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_MEMBER }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Docker build + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/member:latest + docker push ${{ secrets.DOCKER_USERNAME }}/member:latest + + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST }} + key: ${{ secrets.PRIVATE_KEY_3 }} + port: ${{ secrets.PORT }} + source: "./docker-compose-member.yml" + target: "/home/ec2-user/" + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD_3 }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_3 }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/member:latest + docker image prune -a -f + docker-compose up -d From ccac4a5069e6947f3c185d6b6d06906791393318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=20=EC=8A=B9=20=EC=97=B0?= <53565255+seungyeonn-i@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:26:28 +0900 Subject: [PATCH 18/18] Update prod-community-deploy.yml --- .github/workflows/prod-community-deploy.yml | 93 +++++++++++---------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/.github/workflows/prod-community-deploy.yml b/.github/workflows/prod-community-deploy.yml index 09ee511..2f1dfe5 100644 --- a/.github/workflows/prod-community-deploy.yml +++ b/.github/workflows/prod-community-deploy.yml @@ -5,7 +5,7 @@ # 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: CommunityService on: push: @@ -21,47 +21,50 @@ jobs: 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 GiHub 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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.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@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make application.yml + run: | + mkdir -p src/main/resources + echo "$APPLICATION_COMMUNITY" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_COMMUNITY }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Docker build + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/community:latest + docker push ${{ secrets.DOCKER_USERNAME }}/community:latest + + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST }} + key: ${{ secrets.PRIVATE_KEY_3 }} + port: ${{ secrets.PORT }} + source: "./docker-compose-community.yml" + target: "/home/ec2-user/" + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD_3 }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_3 }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/community:latest + docker image prune -a -f + docker-compose up -d