From 062e3a26254da72c40c72a915d6d8ec6091a675c Mon Sep 17 00:00:00 2001 From: Jung-kr Date: Mon, 30 Jun 2025 13:19:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20build,=20deploy=20=EB=B6=84=EB=A6=AC,?= =?UTF-8?q?=20=EB=B0=B0=ED=8F=AC=EC=8B=9C=20=EB=B3=BCvolume=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=ED=95=98=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ed11bce..560398e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,8 +8,8 @@ on: - closed jobs: - deploy: - if: github.event.pull_request.merged == true # merge된 경우에만 실행 + build: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: @@ -41,15 +41,24 @@ jobs: - name: Build Spring Boot JAR (skip tests) run: ./gradlew clean build -x test - - name: Upload project to EC2 + - name: Upload necessary files to EC2 uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.EC2_HOST }} username: ${{ secrets.EC2_USER }} key: ${{ secrets.EC2_KEY }} - source: "." # 전체 프로젝트 복사 + source: | + build/libs/*.jar + Dockerfile + docker-compose.yml + src/main/resources/application-prod.yml target: "~/cote-house/backend" + deploy: + needs: build + runs-on: ubuntu-latest + + steps: - name: SSH to EC2 and deploy uses: appleboy/ssh-action@v1.0.0 with: @@ -62,5 +71,4 @@ jobs: echo "✅ Starting deployment with Docker Compose" docker compose down docker image prune -f - docker volume prune -f docker compose up -d --build \ No newline at end of file