Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: "adopt"
distribution: 'temurin'
cache: gradle

- name: Set environment variables by branch
Expand All @@ -33,14 +33,28 @@ jobs:
chmod +x ./gradlew
./gradlew clean build -x test

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker BUILD_PUSH
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }}:${{ steps.vars.outputs.DOCKER_TAG }} .
docker push ${{ secrets.DOCKER_REPO }}:${{ steps.vars.outputs.DOCKER_TAG }}
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ secrets.DOCKER_REPO }}:${{ steps.vars.outputs.DOCKER_TAG }}

deploy:
runs-on: ubuntu-latest
needs: build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI/CD 단계 분리한거 좋은거 같습니다!

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Copy files to server
uses: appleboy/scp-action@master
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.HOST }}
username: ubuntu
Expand All @@ -49,7 +63,7 @@ jobs:
target: /home/ubuntu/cockple

- name: Deploy
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.HOST }}
username: ubuntu
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
Expand All @@ -34,12 +34,12 @@ jobs:
- name: Grant execute permission for Gradle
run: chmod +x gradlew

- name: Build (Debug Mode)
run: ./gradlew clean build --stacktrace --info --scan
- name: Build
run: ./gradlew build --stacktrace

- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: test-report
path: build/reports/tests/test