Skip to content

Commit

Permalink
CHORE : ci & cd 관련 workflows yml 변경 추가 (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
choidongkuen committed Feb 29, 2024
1 parent 52e3f39 commit 52efb79
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/CI_CD.yml → .github/workflows/deployer.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI/CD Automation using github actions and Docker
name: 🎇 Deployer

on:
push:
Expand All @@ -10,7 +10,6 @@ permissions:
contents: read

jobs:
## CI
build:
name: CI
runs-on: ubuntu-latest
Expand All @@ -24,7 +23,6 @@ jobs:
java-version: '11'
distribution: 'temurin'

# Gradle 캐싱 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
Expand All @@ -41,39 +39,38 @@ jobs:
- name: Build with Gradle
run: ./gradlew build -x test

# Dockerhub Login

- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}

# Docker buildx set up

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Docker build & push

- name: Docker build & push to DockerHub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/better-iter:latest
## CD

deploy:
name: CD
runs-on: ubuntu-latest
needs: build
steps:
# Deploy to prod
- name: Connect to WAS & Execute Application
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST_IP }} # EC2 퍼블릭 IPv4 DNS
username: ${{ secrets.USERNAME }} # ubuntu
host: ${{ secrets.HOST_IP }}
username: ${{ secrets.USERNAME }}
port: 22
key: ${{ secrets.PRIVATE_KEY }} # pem
key: ${{ secrets.PRIVATE_KEY }}
script: |
docker -v
docker ps
Expand Down

0 comments on commit 52efb79

Please sign in to comment.