Skip to content

Commit

Permalink
chore: dev 버전으로 github-actions.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
seohyun-lee committed Aug 19, 2024
1 parent b30fcbb commit f9a1712
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI/CD using GitHub Actions & Docker
# main 또는 deploy 브랜치에 push하면 워크플로우 실행
on:
push:
branches: [ "main", "deploy" ]
branches: [ "main", "deploy", "dev" ]

jobs:
deploy:
Expand All @@ -20,7 +20,7 @@ jobs:
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_PROD }}" > ./application.yml
echo "${{ secrets.APPLICATION }}" > ./application.yml
- name: Gradle Caching
uses: actions/cache@v3
Expand Down Expand Up @@ -49,18 +49,18 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_REPO_PROD }}:latest
tags: ${{ secrets.DOCKER_REPO }}:latest

- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_PROD }}
username: ${{ secrets.USERNAME_PROD }}
key: ${{ secrets.KEY_PROD }}
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
envs: GITHUB_SHA
script: |
echo "${{ secrets.DOCKER_COMPOSE_PROD }}" | sudo tee ./docker-compose.yml
echo "${{ secrets.DOCKER_COMPOSE }}" | sudo tee ./docker-compose.yml
sudo docker ps -q | xargs -r sudo docker stop && sudo docker ps -aq | xargs -r sudo docker rm
sudo docker compose --file ./docker-compose.yml down --rmi all
sudo docker pull ${{ secrets.DOCKER_REPO }}:latest
sudo docker pull ${{ secrets.DOCKER }}:latest
sudo docker compose --file ./docker-compose.yml up -d

0 comments on commit f9a1712

Please sign in to comment.