Skip to content

Fix: 개발 DB 환경설정 yml 파일 비활성화 #19

Fix: 개발 DB 환경설정 yml 파일 비활성화

Fix: 개발 DB 환경설정 yml 파일 비활성화 #19

Workflow file for this run

name: Deploy to Development Server
on:
push:
branches: [ "develop", "feature/cd/deploy" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Copy Secrets
uses: ./.github/actions/copy_secret
with:
profile: dev
# oauth-secret: ${{ secrets.OAUTH_SECRET }}
# s3-secret: ${{ secrets.S3_SECRET }}
dev-db-secret: ${{ secrets.DEV_DB_SECRET }}
- name: Run MySQL image for test
run: docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=join_db mysql:8.0.31
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25
with:
arguments: build
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: |
build/libs/*.jar
Dockerfile
docker-compose.yml
deploy:
needs: build
runs-on: ubuntu-latest
env:
APP_PATH: ${{ secrets.APP_PATH }}
steps:
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
- name: SCP JAR to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
source: "build/libs/*.jar, ./Dockerfile, ./docker-compose.yml"
target: ${{ env.APP_PATH }}
- name: SSH Execute command on EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
script: |
cd ${{ env.APP_PATH }}
docker-compose down --volumes
docker image prune -f
docker-compose up --build -d