From e677c35267e016176ca69f3b7f11c401bebe26bb Mon Sep 17 00:00:00 2001 From: nayonsoso Date: Fri, 14 Feb 2025 15:23:25 +0900 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20stage=EC=9A=A9=20CD=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 --- .github/workflows/stage-cd.yml | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/stage-cd.yml diff --git a/.github/workflows/stage-cd.yml b/.github/workflows/stage-cd.yml new file mode 100644 index 000000000..ceebcbafb --- /dev/null +++ b/.github/workflows/stage-cd.yml @@ -0,0 +1,75 @@ +name: [STAGE] Build Gradle and Deploy + +on: + push: + branches: [ "real-release" ] + workflow_dispatch: + +jobs: + build-gradle: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }} + submodules: true + + - 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: Grant execute permission for Gradle wrapper(gradlew) + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew bootJar -Dspring.profiles.active=prod + + - name: Copy jar file to remote + uses: appleboy/scp-action@master + with: + host: ${{ secrets.STAGE_HOST }} + username: ${{ secrets.STAGE_USERNAME }} + key: ${{ secrets.STAGE_PRIVATE_KEY }} + source: "./build/libs/*.jar" + target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/" + + - name: Copy docker file to remote + uses: appleboy/scp-action@master + with: + host: ${{ secrets.STAGE_HOST }} + username: ${{ secrets.STAGE_USERNAME }} + key: ${{ secrets.STAGE_PRIVATE_KEY }} + source: "./Dockerfile" + target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/" + + - name: Copy docker compose file to remote + uses: appleboy/scp-action@master + with: + host: ${{ secrets.STAGE_HOST }} + username: ${{ secrets.STAGE_USERNAME }} + key: ${{ secrets.STAGE_PRIVATE_KEY }} + source: "./docker-compose.yml" + target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/" + + - name: Run docker compose + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.STAGE_HOST }} + username: ${{ secrets.STAGE_USERNAME }} + key: ${{ secrets.STAGE_PRIVATE_KEY }} + script_stop: true + script: | + cd /home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage + docker compose down + docker compose up -d --build From 1bade793162c324fe60304f276618abf15d70ea5 Mon Sep 17 00:00:00 2001 From: nayonsoso Date: Fri, 14 Feb 2025 15:24:50 +0900 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20=EA=B8=B0=EC=A1=B4=20=EB=A6=B4?= =?UTF-8?q?=EB=A6=AC=EC=A6=88=20cd=EB=A5=BC=20stage=EC=99=80=20=ED=99=95?= =?UTF-8?q?=EC=8B=A4=ED=9E=88=20=EA=B5=AC=EB=B6=84=EB=90=98=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{release.yml => prod-cd.yml} | 4 ++-- .github/workflows/stage-cd.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{release.yml => prod-cd.yml} (97%) diff --git a/.github/workflows/release.yml b/.github/workflows/prod-cd.yml similarity index 97% rename from .github/workflows/release.yml rename to .github/workflows/prod-cd.yml index 43c2e6e80..64444a2eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/prod-cd.yml @@ -1,8 +1,8 @@ -name: Build Gradle and Deploy +name: [PROD] Build Gradle and Deploy on: push: - branches: [ "release" ] + branches: [ "main" ] workflow_dispatch: jobs: diff --git a/.github/workflows/stage-cd.yml b/.github/workflows/stage-cd.yml index ceebcbafb..60f55922b 100644 --- a/.github/workflows/stage-cd.yml +++ b/.github/workflows/stage-cd.yml @@ -2,7 +2,7 @@ name: [STAGE] Build Gradle and Deploy on: push: - branches: [ "real-release" ] + branches: [ "release" ] workflow_dispatch: jobs: From 0b4f4d0d3e1a60304a752e7f123f6fb33a9f570f Mon Sep 17 00:00:00 2001 From: nayonsoso Date: Fri, 14 Feb 2025 16:26:08 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20syntax=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/prod-cd.yml | 2 +- .github/workflows/stage-cd.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index 64444a2eb..1752e6bfd 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -1,4 +1,4 @@ -name: [PROD] Build Gradle and Deploy +name: "[PROD] Build Gradle and Deploy" on: push: diff --git a/.github/workflows/stage-cd.yml b/.github/workflows/stage-cd.yml index 60f55922b..dd6f55e8d 100644 --- a/.github/workflows/stage-cd.yml +++ b/.github/workflows/stage-cd.yml @@ -1,4 +1,4 @@ -name: [STAGE] Build Gradle and Deploy +name: "[STAGE] Build Gradle and Deploy" on: push: From 848691af833ba95b7b09d39c00d470210623c086 Mon Sep 17 00:00:00 2001 From: nayonsoso Date: Sun, 16 Feb 2025 04:38:18 +0900 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20=EC=8A=A4=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=84=9C=EB=B2=84=20=EB=B0=B0=ED=8F=AC=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EA=B0=80=20prod=EC=97=90=20=EC=98=81?= =?UTF-8?q?=ED=96=A5=EC=9D=84=20=EC=A3=BC=EC=A7=80=20=EC=95=8A=EB=8F=84?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/prod-cd.yml | 2 +- .github/workflows/stage-cd.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index 1752e6bfd..7a2601800 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -2,7 +2,7 @@ name: "[PROD] Build Gradle and Deploy" on: push: - branches: [ "main" ] + branches: [ "release" ] # todo: 스테이지 서버 cd 테스트 후 master 로 변경 필요 workflow_dispatch: jobs: diff --git a/.github/workflows/stage-cd.yml b/.github/workflows/stage-cd.yml index dd6f55e8d..7aa70fe65 100644 --- a/.github/workflows/stage-cd.yml +++ b/.github/workflows/stage-cd.yml @@ -2,7 +2,7 @@ name: "[STAGE] Build Gradle and Deploy" on: push: - branches: [ "release" ] + branches: [ "stage-test" ] # todo: 스테이지 서버 cd 테스트 후 release 로 변경 필요 workflow_dispatch: jobs: