diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d089d69..396107a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,10 @@ name: CD on: - push: - branches: - - main # main 브랜치 push 시 자동 배포 - workflow_dispatch: # 수동 실행 + workflow_run: + workflows: ["CI with Gradle"] # CI 워크플로 이름과 정확히 일치해야 함 + types: [completed] # CI가 끝났을 때 트리거 + branches: [main] # main 에서만 permissions: contents: read diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d0d5c0..f05a098 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,12 @@ jobs: - name: Build JAR run: ./gradlew bootJar -x test --no-daemon + - name: Upload JAR artifact + uses: actions/upload-artifact@v4 + with: + name: app-jar + path: build/libs/*.jar + docker-push: name: Docker Build & Push if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' @@ -52,6 +58,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Download JAR artifact + uses: actions/download-artifact@v4 + with: + name: app-jar + path: build/libs + - name: Login to Docker Hub uses: docker/login-action@v3 with: